Sfoglia il codice sorgente

Remove newline && runner plugins

corpglory-dev 6 anni fa
parent
commit
bdd59de877

+ 0 - 35
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/slate-plugins/newline.ts

@@ -1,35 +0,0 @@
-function getIndent(text) {
-  let offset = text.length - text.trimLeft().length;
-  if (offset) {
-    let indent = text[0];
-    while (--offset) {
-      indent += text[0];
-    }
-    return indent;
-  }
-  return '';
-}
-
-export default function NewlinePlugin() {
-  return {
-    onKeyDown(event, change) {
-      const { value } = change;
-      if (!value.isCollapsed) {
-        return undefined;
-      }
-
-      if (event.key === 'Enter' && !event.shiftKey) {
-        event.preventDefault();
-
-        const { startBlock } = value;
-        const currentLineText = startBlock.text;
-        const indent = getIndent(currentLineText);
-
-        return change
-          .splitBlock()
-          .insertText(indent)
-          .focus();
-      }
-    },
-  };
-}

+ 0 - 14
public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/slate-plugins/runner.ts

@@ -1,14 +0,0 @@
-export default function RunnerPlugin({ handler }) {
-  return {
-    onKeyDown(event) {
-      // Handle enter
-      if (handler && event.key === 'Enter' && event.shiftKey) {
-        // Submit on Enter
-        event.preventDefault();
-        handler(event);
-        return true;
-      }
-      return undefined;
-    },
-  };
-}