@jupyterlab/codemirror 0.15.4 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,12 +19,11 @@ CodeMirror.defineMode('ipythongfm', function (config, modeOptions) {
19
19
  var gfmMode = CodeMirror.getMode(config, 'gfm');
20
20
  var texMode = CodeMirror.getMode(config, 'stex');
21
21
  return CodeMirror.multiplexingMode(gfmMode, {
22
- open: '$', close: '$',
22
+ open: '$$', close: '$$',
23
23
  mode: texMode,
24
24
  delimStyle: 'delimit'
25
25
  }, {
26
- // not sure this works as $$ is interpreted at (opening $, closing $, as defined just above)
27
- open: '$$', close: '$$',
26
+ open: '$', close: '$',
28
27
  mode: texMode,
29
28
  delimStyle: 'delimit'
30
29
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"codemirror-ipythongfm.js","sourceRoot":"","sources":["../../../../codemirror/src/codemirror-ipythongfm.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,uCACoB;AAEpB,qCAAmC;AACnC,mCAAiC;AACjC,2CAAyC;AAGzC;;;;;;;;GAQG;AACH,UAAU,CAAC,UAAU,CAAC,YAAY,EAAE,UAAC,MAAsC,EAAE,WAAiB;IAC5F,IAAI,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChD,IAAI,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjD,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAChC,OAAO,EACP;QACE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;QACrB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB,EACD;QACE,4FAA4F;QAC5F,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI;QACvB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB,EACD;QACE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;QACzB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB,EACD;QACE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;QACzB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB;IACD,6CAA6C;KAC9C,CAAC;AACJ,CAAC,EAAE,KAAK,CAAC,CAAC;AAEV,UAAU,CAAC,UAAU,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;AACzD,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;IACvB,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport * as CodeMirror\n from 'codemirror';\n\nimport 'codemirror/mode/stex/stex';\nimport 'codemirror/mode/gfm/gfm';\nimport 'codemirror/addon/mode/multiplex';\n\n\n/**\n * Define an IPython GFM (GitHub Flavored Markdown) mode.\n *\n * Is just a slightly altered GFM Mode with support for LaTeX.\n * LaTeX support was supported by Codemirror GFM as of\n * https://github.com/codemirror/CodeMirror/pull/567\n * But was later removed in\n * https://github.com/codemirror/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c\n */\nCodeMirror.defineMode('ipythongfm', (config: CodeMirror.EditorConfiguration, modeOptions?: any) => {\n let gfmMode = CodeMirror.getMode(config, 'gfm');\n let texMode = CodeMirror.getMode(config, 'stex');\n\n return CodeMirror.multiplexingMode(\n gfmMode,\n {\n open: '$', close: '$',\n mode: texMode,\n delimStyle: 'delimit'\n },\n {\n // not sure this works as $$ is interpreted at (opening $, closing $, as defined just above)\n open: '$$', close: '$$',\n mode: texMode,\n delimStyle: 'delimit'\n },\n {\n open: '\\\\(', close: '\\\\)',\n mode: texMode,\n delimStyle: 'delimit'\n },\n {\n open: '\\\\[', close: '\\\\]',\n mode: texMode,\n delimStyle: 'delimit'\n }\n // .. more multiplexed styles can follow here\n );\n}, 'gfm');\n\nCodeMirror.defineMIME('text/x-ipythongfm', 'ipythongfm');\nCodeMirror.modeInfo.push({\n ext: [],\n mime: 'text/x-ipythongfm',\n mode: 'ipythongfm',\n name: 'ipythongfm'\n});\n"]}
1
+ {"version":3,"file":"codemirror-ipythongfm.js","sourceRoot":"","sources":["../../../../codemirror/src/codemirror-ipythongfm.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,uCACoB;AAEpB,qCAAmC;AACnC,mCAAiC;AACjC,2CAAyC;AAGzC;;;;;;;;GAQG;AACH,UAAU,CAAC,UAAU,CAAC,YAAY,EAAE,UAAC,MAAsC,EAAE,WAAiB;IAC5F,IAAI,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChD,IAAI,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjD,MAAM,CAAC,UAAU,CAAC,gBAAgB,CAChC,OAAO,EACP;QACE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI;QACvB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB,EACD;QACE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG;QACrB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB,EACD;QACE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;QACzB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB,EACD;QACE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;QACzB,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,SAAS;KACtB;IACD,6CAA6C;KAC9C,CAAC;AACJ,CAAC,EAAE,KAAK,CAAC,CAAC;AAEV,UAAU,CAAC,UAAU,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;AACzD,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;IACvB,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport * as CodeMirror\n from 'codemirror';\n\nimport 'codemirror/mode/stex/stex';\nimport 'codemirror/mode/gfm/gfm';\nimport 'codemirror/addon/mode/multiplex';\n\n\n/**\n * Define an IPython GFM (GitHub Flavored Markdown) mode.\n *\n * Is just a slightly altered GFM Mode with support for LaTeX.\n * LaTeX support was supported by Codemirror GFM as of\n * https://github.com/codemirror/CodeMirror/pull/567\n * But was later removed in\n * https://github.com/codemirror/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c\n */\nCodeMirror.defineMode('ipythongfm', (config: CodeMirror.EditorConfiguration, modeOptions?: any) => {\n let gfmMode = CodeMirror.getMode(config, 'gfm');\n let texMode = CodeMirror.getMode(config, 'stex');\n\n return CodeMirror.multiplexingMode(\n gfmMode,\n {\n open: '$$', close: '$$',\n mode: texMode,\n delimStyle: 'delimit'\n },\n {\n open: '$', close: '$',\n mode: texMode,\n delimStyle: 'delimit'\n },\n {\n open: '\\\\(', close: '\\\\)',\n mode: texMode,\n delimStyle: 'delimit'\n },\n {\n open: '\\\\[', close: '\\\\]',\n mode: texMode,\n delimStyle: 'delimit'\n }\n // .. more multiplexed styles can follow here\n );\n}, 'gfm');\n\nCodeMirror.defineMIME('text/x-ipythongfm', 'ipythongfm');\nCodeMirror.modeInfo.push({\n ext: [],\n mime: 'text/x-ipythongfm',\n mode: 'ipythongfm',\n name: 'ipythongfm'\n});\n"]}
package/lib/editor.d.ts CHANGED
@@ -183,6 +183,7 @@ export declare class CodeMirrorEditor implements CodeEditor.IEditor {
183
183
  * Passing an empty array resets a cursor position to the start of a document.
184
184
  */
185
185
  setSelections(selections: CodeEditor.IRange[]): void;
186
+ newIndentedLine(): void;
186
187
  /**
187
188
  * Execute a codemirror command on the editor.
188
189
  *
@@ -324,7 +325,7 @@ export declare namespace CodeMirrorEditor {
324
325
  /**
325
326
  * The mode to use.
326
327
  */
327
- mode?: string | Mode.ISpec;
328
+ mode?: string | Mode.IMode;
328
329
  /**
329
330
  * The theme to style the editor with.
330
331
  * You must make sure the CSS file defining the corresponding
package/lib/editor.js CHANGED
@@ -447,6 +447,9 @@ var CodeMirrorEditor = /** @class */ (function () {
447
447
  var cmSelections = this._toCodeMirrorSelections(selections);
448
448
  this.doc.setSelections(cmSelections, 0);
449
449
  };
450
+ CodeMirrorEditor.prototype.newIndentedLine = function () {
451
+ this.execCommand('newlineAndIndent');
452
+ };
450
453
  /**
451
454
  * Execute a codemirror command on the editor.
452
455
  *
package/lib/editor.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../../codemirror/src/editor.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;;;;;;;;;AAE3D,uCACoB;AAEpB,iDAE6B;AAE7B,iDAE6B;AAE7B,mDAE8B;AAE9B,iDAE6B;AAE7B,iDAE8B;AAE9B,qDAEgC;AAEhC,mDAE+B;AAM/B,+BAEgB;AAEhB,+CAA6C;AAC7C,kDAAgD;AAChD,kDAAgD;AAChD,oDAAkD;AAClD,gDAA8C;AAC9C,0CAAwC;AACxC,sCAAoC;AACpC,wCAAsC;AACtC,oCAAkC;AAGlC;;GAEG;AACH,IAAM,YAAY,GAAG,qBAAqB,CAAC;AAE3C;;GAEG;AACH,IAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C;;GAEG;AACH,IAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAE1D;;GAEG;AACH,IAAM,wBAAwB,GAAG,6BAA6B,CAAC;AAE/D;;GAEG;AACH,IAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB;;GAEG;AACH,IAAM,UAAU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KAAK,CAAC;YACR;gBACE,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAChC,KAAK,CAAC;QACR,CAAC;IACH,CAAC;IA5BQ,iBAAS,YA4BjB,CAAA;AACH,CAAC,EAjIS,OAAO,KAAP,OAAO,QAiIhB;AAGD;;;GAGG;AACH,gBAAgB,CAAC,UAAU,CACzB,uBAAuB,EAAE,OAAO,CAAC,qBAAqB,CACvD,CAAC;AAGF;;GAEG;AACH,gBAAgB,CAAC,UAAU,CACzB,uBAAuB,EAAE,OAAO,CAAC,qBAAqB,CACvD,CAAC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport * as CodeMirror\n from 'codemirror';\n\nimport {\n JSONExt\n} from '@phosphor/coreutils';\n\nimport {\n ArrayExt\n} from '@phosphor/algorithm';\n\nimport {\n IDisposable, DisposableDelegate\n} from '@phosphor/disposable';\n\nimport {\n Signal\n} from '@phosphor/signaling';\n\nimport {\n showDialog\n} from '@jupyterlab/apputils';\n\nimport {\n CodeEditor\n} from '@jupyterlab/codeeditor';\n\nimport {\n uuid\n} from '@jupyterlab/coreutils';\n\nimport {\n IObservableMap, IObservableString, ICollaborator\n} from '@jupyterlab/observables';\n\nimport {\n Mode\n} from './mode';\n\nimport 'codemirror/addon/comment/comment.js';\nimport 'codemirror/addon/edit/matchbrackets.js';\nimport 'codemirror/addon/edit/closebrackets.js';\nimport 'codemirror/addon/scroll/scrollpastend.js';\nimport 'codemirror/addon/search/searchcursor';\nimport 'codemirror/addon/search/search';\nimport 'codemirror/keymap/emacs.js';\nimport 'codemirror/keymap/sublime.js';\nimport 'codemirror/keymap/vim.js';\n\n\n/**\n * The class name added to CodeMirrorWidget instances.\n */\nconst EDITOR_CLASS = 'jp-CodeMirrorEditor';\n\n/**\n * The class name added to read only cell editor widgets.\n */\nconst READ_ONLY_CLASS = 'jp-mod-readOnly';\n\n/**\n * The class name for the hover box for collaborator cursors.\n */\nconst COLLABORATOR_CURSOR_CLASS = 'jp-CollaboratorCursor';\n\n/**\n * The class name for the hover box for collaborator cursors.\n */\nconst COLLABORATOR_HOVER_CLASS = 'jp-CollaboratorCursor-hover';\n\n/**\n * The key code for the up arrow key.\n */\nconst UP_ARROW = 38;\n\n/**\n * The key code for the down arrow key.\n */\nconst DOWN_ARROW = 40;\n\n/**\n * The time that a collaborator name hover persists.\n */\nconst HOVER_TIMEOUT = 1000;\n\n\n/**\n * CodeMirror editor.\n */\nexport\nclass CodeMirrorEditor implements CodeEditor.IEditor {\n /**\n * Construct a CodeMirror editor.\n */\n constructor(options: CodeMirrorEditor.IOptions) {\n let host = this.host = options.host;\n host.classList.add(EDITOR_CLASS);\n host.classList.add('jp-Editor');\n host.addEventListener('focus', this, true);\n host.addEventListener('blur', this, true);\n host.addEventListener('scroll', this, true);\n\n this._uuid = options.uuid || uuid();\n\n // Handle selection style.\n let style = options.selectionStyle || {};\n this._selectionStyle = {\n ...CodeEditor.defaultSelectionStyle,\n ...style as CodeEditor.ISelectionStyle\n };\n\n let model = this._model = options.model;\n let editor = this._editor = CodeMirror(host, {});\n Private.handleConfig(editor, options.config || {});\n\n let doc = editor.getDoc();\n\n // Handle initial values for text, mimetype, and selections.\n doc.setValue(model.value.text);\n this._onMimeTypeChanged();\n this._onCursorActivity();\n this._timer = window.setInterval(() => { this._checkSync(); }, 3000);\n\n // Connect to changes.\n model.value.changed.connect(this._onValueChanged, this);\n model.mimeTypeChanged.connect(this._onMimeTypeChanged, this);\n model.selections.changed.connect(this._onSelectionsChanged, this);\n\n CodeMirror.on(editor, 'keydown', (editor, event) => {\n let index = ArrayExt.findFirstIndex(this._keydownHandlers, handler => {\n if (handler(this, event) === true) {\n event.preventDefault();\n return true;\n }\n return false;\n });\n if (index === -1) {\n this.onKeydown(event);\n }\n });\n CodeMirror.on(editor, 'cursorActivity', () => this._onCursorActivity());\n CodeMirror.on(editor.getDoc(), 'beforeChange', (instance, change) => {\n this._beforeDocChanged(instance, change);\n });\n CodeMirror.on(editor.getDoc(), 'change', (instance, change) => {\n // Manually refresh after setValue to make sure editor is properly sized.\n if (change.origin === 'setValue' && this.hasFocus()) {\n this.refresh();\n }\n this._lastChange = change;\n });\n\n // Manually refresh on paste to make sure editor is properly sized.\n editor.getWrapperElement().addEventListener('paste', () => {\n if (this.hasFocus()) {\n this.refresh();\n }\n });\n }\n\n /**\n * A signal emitted when either the top or bottom edge is requested.\n */\n readonly edgeRequested = new Signal<this, CodeEditor.EdgeLocation>(this);\n\n /**\n * The DOM node that hosts the editor.\n */\n readonly host: HTMLElement;\n\n /**\n * The uuid of this editor;\n */\n get uuid(): string {\n return this._uuid;\n }\n set uuid(value: string) {\n this._uuid = value;\n }\n\n /**\n * The selection style of this editor.\n */\n get selectionStyle(): CodeEditor.ISelectionStyle {\n return this._selectionStyle;\n }\n set selectionStyle(value: CodeEditor.ISelectionStyle) {\n this._selectionStyle = value;\n }\n\n /**\n * Get the codemirror editor wrapped by the editor.\n */\n get editor(): CodeMirror.Editor {\n return this._editor;\n }\n\n /**\n * Get the codemirror doc wrapped by the widget.\n */\n get doc(): CodeMirror.Doc {\n return this._editor.getDoc();\n }\n\n /**\n * Get the number of lines in the editor.\n */\n get lineCount(): number {\n return this.doc.lineCount();\n }\n\n /**\n * Returns a model for this editor.\n */\n get model(): CodeEditor.IModel {\n return this._model;\n }\n\n /**\n * The height of a line in the editor in pixels.\n */\n get lineHeight(): number {\n return this._editor.defaultTextHeight();\n }\n\n /**\n * The widget of a character in the editor in pixels.\n */\n get charWidth(): number {\n return this._editor.defaultCharWidth();\n }\n\n /**\n * Tests whether the editor is disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n this.host.removeEventListener('focus', this, true);\n this.host.removeEventListener('blur', this, true);\n this.host.removeEventListener('scroll', this, true);\n this._keydownHandlers.length = 0;\n window.clearInterval(this._timer);\n Signal.clearData(this);\n }\n\n /**\n * Get a config option for the editor.\n */\n getOption<K extends keyof CodeMirrorEditor.IConfig>(option: K): CodeMirrorEditor.IConfig[K] {\n return Private.getOption(this.editor, option);\n }\n\n /**\n * Set a config option for the editor.\n */\n setOption<K extends keyof CodeMirrorEditor.IConfig>(option: K, value: CodeMirrorEditor.IConfig[K]): void {\n Private.setOption(this.editor, option, value);\n }\n\n /**\n * Returns the content for the given line number.\n */\n getLine(line: number): string | undefined {\n return this.doc.getLine(line);\n }\n\n /**\n * Find an offset for the given position.\n */\n getOffsetAt(position: CodeEditor.IPosition): number {\n return this.doc.indexFromPos({\n ch: position.column,\n line: position.line\n });\n }\n\n /**\n * Find a position fot the given offset.\n */\n getPositionAt(offset: number): CodeEditor.IPosition {\n const { ch, line } = this.doc.posFromIndex(offset);\n return { line, column: ch };\n }\n\n /**\n * Undo one edit (if any undo events are stored).\n */\n undo(): void {\n this.doc.undo();\n }\n\n /**\n * Redo one undone edit.\n */\n redo(): void {\n this.doc.redo();\n }\n\n /**\n * Clear the undo history.\n */\n clearHistory(): void {\n this.doc.clearHistory();\n }\n\n /**\n * Brings browser focus to this editor text.\n */\n focus(): void {\n this._editor.focus();\n }\n\n /**\n * Test whether the editor has keyboard focus.\n */\n hasFocus(): boolean {\n return this._editor.getWrapperElement().contains(document.activeElement);\n }\n\n /**\n * Explicitly blur the editor.\n */\n blur(): void {\n this._editor.getInputField().blur();\n }\n\n /**\n * Repaint editor.\n */\n refresh(): void {\n this._editor.refresh();\n this._needsRefresh = false;\n }\n\n /**\n * Refresh the editor if it is focused;\n * otherwise postpone refreshing till focusing.\n */\n resizeToFit(): void {\n if (this.hasFocus()) {\n this.refresh();\n } else {\n this._needsRefresh = true;\n }\n this._clearHover();\n }\n\n /**\n * Add a keydown handler to the editor.\n *\n * @param handler - A keydown handler.\n *\n * @returns A disposable that can be used to remove the handler.\n */\n addKeydownHandler(handler: CodeEditor.KeydownHandler): IDisposable {\n this._keydownHandlers.push(handler);\n return new DisposableDelegate(() => {\n ArrayExt.removeAllWhere(this._keydownHandlers, val => val === handler);\n });\n }\n\n /**\n * Set the size of the editor in pixels.\n */\n setSize(dimension: CodeEditor.IDimension | null): void {\n if (dimension) {\n this._editor.setSize(dimension.width, dimension.height);\n } else {\n this._editor.setSize(null, null);\n }\n this._needsRefresh = false;\n }\n\n /**\n * Reveal the given position in the editor.\n */\n revealPosition(position: CodeEditor.IPosition): void {\n const cmPosition = this._toCodeMirrorPosition(position);\n this._editor.scrollIntoView(cmPosition);\n }\n\n /**\n * Reveal the given selection in the editor.\n */\n revealSelection(selection: CodeEditor.IRange): void {\n const range = this._toCodeMirrorRange(selection);\n this._editor.scrollIntoView(range);\n }\n\n /**\n * Get the window coordinates given a cursor position.\n */\n getCoordinateForPosition(position: CodeEditor.IPosition): CodeEditor.ICoordinate {\n const pos = this._toCodeMirrorPosition(position);\n const rect = this.editor.charCoords(pos, 'page');\n return rect as CodeEditor.ICoordinate;\n }\n\n /**\n * Get the cursor position given window coordinates.\n *\n * @param coordinate - The desired coordinate.\n *\n * @returns The position of the coordinates, or null if not\n * contained in the editor.\n */\n getPositionForCoordinate(coordinate: CodeEditor.ICoordinate): CodeEditor.IPosition | null {\n return this._toPosition(this.editor.coordsChar(coordinate)) || null;\n }\n\n /**\n * Returns the primary position of the cursor, never `null`.\n */\n getCursorPosition(): CodeEditor.IPosition {\n const cursor = this.doc.getCursor();\n return this._toPosition(cursor);\n }\n\n /**\n * Set the primary position of the cursor.\n *\n * #### Notes\n * This will remove any secondary cursors.\n */\n setCursorPosition(position: CodeEditor.IPosition): void {\n const cursor = this._toCodeMirrorPosition(position);\n this.doc.setCursor(cursor);\n // If the editor does not have focus, this cursor change\n // will get screened out in _onCursorsChanged(). Make an\n // exception for this method.\n if (!this.editor.hasFocus()) {\n this.model.selections.set(this.uuid, this.getSelections());\n }\n }\n\n /**\n * Returns the primary selection, never `null`.\n */\n getSelection(): CodeEditor.ITextSelection {\n return this.getSelections()[0];\n }\n\n /**\n * Set the primary selection. This will remove any secondary cursors.\n */\n setSelection(selection: CodeEditor.IRange): void {\n this.setSelections([selection]);\n }\n\n /**\n * Gets the selections for all the cursors, never `null` or empty.\n */\n getSelections(): CodeEditor.ITextSelection[] {\n const selections = this.doc.listSelections();\n if (selections.length > 0) {\n return selections.map(selection => this._toSelection(selection));\n }\n const cursor = this.doc.getCursor();\n const selection = this._toSelection({ anchor: cursor, head: cursor });\n return [selection];\n }\n\n /**\n * Sets the selections for all the cursors, should not be empty.\n * Cursors will be removed or added, as necessary.\n * Passing an empty array resets a cursor position to the start of a document.\n */\n setSelections(selections: CodeEditor.IRange[]): void {\n const cmSelections = this._toCodeMirrorSelections(selections);\n this.doc.setSelections(cmSelections, 0);\n }\n\n /**\n * Execute a codemirror command on the editor.\n *\n * @param command - The name of the command to execute.\n */\n execCommand(command: string): void {\n this._editor.execCommand(command);\n }\n\n /**\n * Handle keydown events from the editor.\n */\n protected onKeydown(event: KeyboardEvent): boolean {\n let position = this.getCursorPosition();\n let { line, column } = position;\n\n if (line === 0 && column === 0 && event.keyCode === UP_ARROW) {\n if (!event.shiftKey) {\n this.edgeRequested.emit('top');\n }\n return false;\n }\n\n let lastLine = this.lineCount - 1;\n let lastCh = this.getLine(lastLine)!.length;\n if (line === lastLine && column === lastCh\n && event.keyCode === DOWN_ARROW) {\n if (!event.shiftKey) {\n this.edgeRequested.emit('bottom');\n }\n return false;\n }\n return false;\n }\n\n /**\n * Converts selections to code mirror selections.\n */\n private _toCodeMirrorSelections(selections: CodeEditor.IRange[]): CodeMirror.Selection[] {\n if (selections.length > 0) {\n return selections.map(selection => this._toCodeMirrorSelection(selection));\n }\n const position = { line: 0, ch: 0 };\n return [{ anchor: position, head: position }];\n }\n\n /**\n * Handles a mime type change.\n */\n private _onMimeTypeChanged(): void {\n const mime = this._model.mimeType;\n let editor = this._editor;\n Mode.ensure(mime).then(spec => {\n editor.setOption('mode', spec.mime);\n });\n let extraKeys = editor.getOption('extraKeys') || {};\n const isCode = (mime !== 'text/plain') && (mime !== 'text/x-ipythongfm');\n if (isCode) {\n extraKeys['Backspace'] = 'delSpaceToPrevTabStop';\n } else {\n delete extraKeys['Backspace'];\n }\n editor.setOption('extraKeys', extraKeys);\n }\n\n /**\n * Handles a selections change.\n */\n private _onSelectionsChanged(selections: IObservableMap<CodeEditor.ITextSelection[]>, args: IObservableMap.IChangedArgs<CodeEditor.ITextSelection[]>): void {\n const uuid = args.key;\n if (uuid !== this.uuid) {\n this._cleanSelections(uuid);\n if (args.type !== 'remove' && args.newValue) {\n this._markSelections(uuid, args.newValue);\n }\n }\n }\n\n /**\n * Clean selections for the given uuid.\n */\n private _cleanSelections(uuid: string) {\n const markers = this.selectionMarkers[uuid];\n if (markers) {\n markers.forEach(marker => { marker.clear(); });\n }\n delete this.selectionMarkers[uuid];\n }\n\n /**\n * Marks selections.\n */\n private _markSelections(uuid: string, selections: CodeEditor.ITextSelection[]) {\n const markers: CodeMirror.TextMarker[] = [];\n\n // If we are marking selections corresponding to an active hover,\n // remove it.\n if (uuid === this._hoverId) {\n this._clearHover();\n }\n // If we can id the selection to a specific collaborator,\n // use that information.\n let collaborator: ICollaborator | undefined;\n if (this._model.modelDB.collaborators) {\n collaborator = this._model.modelDB.collaborators.get(uuid);\n }\n\n // Style each selection for the uuid.\n selections.forEach(selection => {\n // Only render selections if the start is not equal to the end.\n // In that case, we don't need to render the cursor.\n if (!JSONExt.deepEqual(selection.start, selection.end)) {\n const { anchor, head } = this._toCodeMirrorSelection(selection);\n let markerOptions: CodeMirror.TextMarkerOptions;\n if (collaborator) {\n markerOptions = this._toTextMarkerOptions({\n ...selection.style,\n color: collaborator.color\n });\n } else {\n markerOptions = this._toTextMarkerOptions(selection.style);\n }\n markers.push(this.doc.markText(anchor, head, markerOptions));\n } else if (collaborator) {\n let caret = this._getCaret(collaborator);\n markers.push(this.doc.setBookmark(\n this._toCodeMirrorPosition(selection.end), {widget: caret}));\n }\n });\n this.selectionMarkers[uuid] = markers;\n }\n\n /**\n * Handles a cursor activity event.\n */\n private _onCursorActivity(): void {\n // Only add selections if the editor has focus. This avoids unwanted\n // triggering of cursor activity due to collaborator actions.\n if (this._editor.hasFocus()) {\n const selections = this.getSelections();\n this.model.selections.set(this.uuid, selections);\n }\n }\n\n /**\n * Converts a code mirror selection to an editor selection.\n */\n private _toSelection(selection: CodeMirror.Selection): CodeEditor.ITextSelection {\n return {\n uuid: this.uuid,\n start: this._toPosition(selection.anchor),\n end: this._toPosition(selection.head),\n style: this.selectionStyle\n };\n }\n\n /**\n * Converts the selection style to a text marker options.\n */\n private _toTextMarkerOptions(style: CodeEditor.ISelectionStyle): CodeMirror.TextMarkerOptions {\n let r = parseInt(style.color.slice(1, 3), 16);\n let g = parseInt(style.color.slice(3, 5), 16);\n let b = parseInt(style.color.slice(5, 7), 16);\n let css = `background-color: rgba( ${r}, ${g}, ${b}, 0.15)`;\n return {\n className: style.className,\n title: style.displayName,\n css\n };\n }\n\n /**\n * Converts an editor selection to a code mirror selection.\n */\n private _toCodeMirrorSelection(selection: CodeEditor.IRange): CodeMirror.Selection {\n // Selections only appear to render correctly if the anchor\n // is before the head in the document. That is, reverse selections\n // do not appear as intended.\n let forward: boolean = (selection.start.line < selection.end.line) ||\n (selection.start.line === selection.end.line &&\n selection.start.column <= selection.end.column);\n let anchor = forward ? selection.start : selection.end;\n let head = forward ? selection.end : selection.start;\n return {\n anchor: this._toCodeMirrorPosition(anchor),\n head: this._toCodeMirrorPosition(head)\n };\n }\n\n /**\n * Converts an editor selection to a code mirror selection.\n */\n private _toCodeMirrorRange(range: CodeEditor.IRange): CodeMirror.Range {\n return {\n from: this._toCodeMirrorPosition(range.start),\n to: this._toCodeMirrorPosition(range.end)\n };\n }\n\n /**\n * Convert a code mirror position to an editor position.\n */\n private _toPosition(position: CodeMirror.Position) {\n return {\n line: position.line,\n column: position.ch\n };\n }\n\n /**\n * Convert an editor position to a code mirror position.\n */\n private _toCodeMirrorPosition(position: CodeEditor.IPosition) {\n return {\n line: position.line,\n ch: position.column\n };\n }\n\n /**\n * Handle model value changes.\n */\n private _onValueChanged(value: IObservableString, args: IObservableString.IChangedArgs): void {\n if (this._changeGuard) {\n return;\n }\n this._changeGuard = true;\n let doc = this.doc;\n switch (args.type) {\n case 'insert':\n let pos = doc.posFromIndex(args.start);\n doc.replaceRange(args.value, pos, pos);\n break;\n case 'remove':\n let from = doc.posFromIndex(args.start);\n let to = doc.posFromIndex(args.end);\n doc.replaceRange('', from, to);\n break;\n case 'set':\n doc.setValue(args.value);\n break;\n default:\n break;\n }\n this._changeGuard = false;\n }\n\n /**\n * Handles document changes.\n */\n private _beforeDocChanged(doc: CodeMirror.Doc, change: CodeMirror.EditorChange) {\n if (this._changeGuard) {\n return;\n }\n this._changeGuard = true;\n let value = this._model.value;\n let start = doc.indexFromPos(change.from);\n let end = doc.indexFromPos(change.to);\n let inserted = change.text.join('\\n');\n\n if (end !== start) {\n value.remove(start, end);\n }\n if (inserted) {\n value.insert(start, inserted);\n }\n this._changeGuard = false;\n }\n\n /**\n * Handle the DOM events for the editor.\n *\n * @param event - The DOM event sent to the editor.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the editor's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n case 'scroll':\n this._evtScroll();\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle `focus` events for the editor.\n */\n private _evtFocus(event: FocusEvent): void {\n if (this._needsRefresh) {\n this.refresh();\n }\n this.host.classList.add('jp-mod-focused');\n }\n\n /**\n * Handle `blur` events for the editor.\n */\n private _evtBlur(event: FocusEvent): void {\n this.host.classList.remove('jp-mod-focused');\n }\n\n /**\n * Handle `scroll` events for the editor.\n */\n private _evtScroll(): void {\n // Remove any active hover.\n this._clearHover();\n }\n\n /**\n * Clear the hover for a caret, due to things like\n * scrolling, resizing, deactivation, etc, where\n * the position is no longer valid.\n */\n private _clearHover(): void {\n if (this._caretHover) {\n window.clearTimeout(this._hoverTimeout);\n document.body.removeChild(this._caretHover);\n this._caretHover = null;\n }\n }\n\n /**\n * Construct a caret element representing the position\n * of a collaborator's cursor.\n */\n private _getCaret(collaborator: ICollaborator): HTMLElement {\n let name = collaborator ? collaborator.displayName : 'Anonymous';\n let color = collaborator ? collaborator.color : this._selectionStyle.color;\n let caret: HTMLElement = document.createElement('span');\n caret.className = COLLABORATOR_CURSOR_CLASS;\n caret.style.borderBottomColor = color;\n caret.onmouseenter = () => {\n this._clearHover();\n this._hoverId = collaborator.sessionId;\n let rect = caret.getBoundingClientRect();\n // Construct and place the hover box.\n let hover = document.createElement('div');\n hover.className = COLLABORATOR_HOVER_CLASS;\n hover.style.left = String(rect.left) + 'px';\n hover.style.top = String(rect.bottom) + 'px';\n hover.textContent = name;\n hover.style.backgroundColor = color;\n\n // If the user mouses over the hover, take over the timer.\n hover.onmouseenter = () => {\n window.clearTimeout(this._hoverTimeout);\n };\n hover.onmouseleave = () => {\n this._hoverTimeout = window.setTimeout(() => {\n this._clearHover();\n }, HOVER_TIMEOUT);\n };\n this._caretHover = hover;\n document.body.appendChild(hover);\n };\n caret.onmouseleave = () => {\n this._hoverTimeout = window.setTimeout(() => {\n this._clearHover();\n }, HOVER_TIMEOUT);\n };\n return caret;\n }\n\n /**\n * Check for an out of sync editor.\n */\n private _checkSync(): void {\n let change = this._lastChange;\n if (!change) {\n return;\n }\n this._lastChange = null;\n let editor = this._editor;\n let doc = editor.getDoc();\n if (doc.getValue() === this._model.value.text) {\n return;\n }\n\n showDialog({\n title: 'Code Editor out of Sync',\n body: 'Please open your browser JavaScript console for bug report instructions'\n });\n console.log('Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951');\n console.log(JSON.stringify({\n model: this._model.value.text,\n view: doc.getValue(),\n selections: this.getSelections(),\n cursor: this.getCursorPosition(),\n lineSep: editor.getOption('lineSeparator'),\n mode: editor.getOption('mode'),\n change\n }));\n }\n\n private _model: CodeEditor.IModel;\n private _editor: CodeMirror.Editor;\n protected selectionMarkers: { [key: string]: CodeMirror.TextMarker[] | undefined } = {};\n private _caretHover: HTMLElement | null;\n private _hoverTimeout: number;\n private _hoverId: string;\n private _keydownHandlers = new Array<CodeEditor.KeydownHandler>();\n private _changeGuard = false;\n private _selectionStyle: CodeEditor.ISelectionStyle;\n private _uuid = '';\n private _needsRefresh = false;\n private _isDisposed = false;\n private _lastChange: CodeMirror.EditorChange | null = null;\n private _timer = -1;\n}\n\n\n/**\n * The namespace for `CodeMirrorEditor` statics.\n */\nexport\nnamespace CodeMirrorEditor {\n /**\n * The options used to initialize a code mirror editor.\n */\n export\n interface IOptions extends CodeEditor.IOptions {\n /**\n * The configuration options for the editor.\n */\n config?: Partial<IConfig>;\n }\n\n /**\n * The configuration options for a codemirror editor.\n */\n export\n interface IConfig extends CodeEditor.IConfig {\n /**\n * The mode to use.\n */\n mode?: string | Mode.ISpec;\n\n /**\n * The theme to style the editor with.\n * You must make sure the CSS file defining the corresponding\n * .cm-s-[name] styles is loaded.\n */\n theme?: string;\n\n /**\n * Whether to use the context-sensitive indentation that the mode provides\n * (or just indent the same as the line before).\n */\n smartIndent?: boolean;\n\n /**\n * Configures whether the editor should re-indent the current line when a\n * character is typed that might change its proper indentation\n * (only works if the mode supports indentation).\n */\n electricChars?: boolean;\n\n /**\n * Configures the keymap to use. The default is \"default\", which is the\n * only keymap defined in codemirror.js itself.\n * Extra keymaps are found in the CodeMirror keymap directory.\n */\n keyMap?: string;\n\n /**\n * Can be used to specify extra keybindings for the editor, alongside the\n * ones defined by keyMap. Should be either null, or a valid keymap value.\n */\n extraKeys?: any;\n\n /**\n * Can be used to add extra gutters (beyond or instead of the line number\n * gutter).\n * Should be an array of CSS class names, each of which defines a width\n * (and optionally a background),\n * and which will be used to draw the background of the gutters.\n * May include the CodeMirror-linenumbers class, in order to explicitly\n * set the position of the line number gutter\n * (it will default to be to the right of all other gutters).\n * These class names are the keys passed to setGutterMarker.\n */\n gutters?: ReadonlyArray<string>;\n\n /**\n * Determines whether the gutter scrolls along with the content\n * horizontally (false)\n * or whether it stays fixed during horizontal scrolling (true,\n * the default).\n */\n fixedGutter?: boolean;\n\n /**\n * Whether the cursor should be drawn when a selection is active.\n */\n showCursorWhenSelecting?: boolean;\n\n /**\n * When fixedGutter is on, and there is a horizontal scrollbar, by default\n * the gutter will be visible to the left of this scrollbar. If this\n * option is set to true, it will be covered by an element with class\n * CodeMirror-gutter-filler.\n */\n coverGutterNextToScrollbar?: boolean;\n\n /**\n * Controls whether drag-and-drop is enabled.\n */\n dragDrop?: boolean;\n\n /**\n * Explicitly set the line separator for the editor.\n * By default (value null), the document will be split on CRLFs as well as\n * lone CRs and LFs, and a single LF will be used as line separator in all\n * output (such as getValue). When a specific string is given, lines will\n * only be split on that string, and output will, by default, use that\n * same separator.\n */\n lineSeparator?: string | null;\n\n /**\n * Chooses a scrollbar implementation. The default is \"native\", showing\n * native scrollbars. The core library also provides the \"null\" style,\n * which completely hides the scrollbars. Addons can implement additional\n * scrollbar models.\n */\n scrollbarStyle?: string;\n\n /**\n * When enabled, which is the default, doing copy or cut when there is no\n * selection will copy or cut the whole lines that have cursors on them.\n */\n lineWiseCopyCut?: boolean;\n\n /**\n * Whether to scroll past the end of the buffer.\n */\n scrollPastEnd?: boolean;\n }\n\n /**\n * The default configuration options for an editor.\n */\n export\n let defaultConfig: IConfig = {\n ...CodeEditor.defaultConfig,\n mode: 'null',\n theme: 'jupyter',\n smartIndent: true,\n electricChars: true,\n keyMap: 'default',\n extraKeys: null,\n gutters: Object.freeze([]),\n fixedGutter: true,\n showCursorWhenSelecting: false,\n coverGutterNextToScrollbar: false,\n dragDrop: true,\n lineSeparator: null,\n scrollbarStyle: 'native',\n lineWiseCopyCut: true,\n scrollPastEnd: false\n };\n\n /**\n * Add a command to CodeMirror.\n *\n * @param name - The name of the command to add.\n *\n * @param command - The command function.\n */\n export\n function addCommand(name: string, command: (cm: CodeMirror.Editor) => void) {\n CodeMirror.commands[name] = command;\n }\n}\n\n\n/**\n * The namespace for module private data.\n */\nnamespace Private {\n /**\n * Handle the codemirror configuration options.\n */\n export\n function handleConfig(editor: CodeMirror.Editor, config: Partial<CodeMirrorEditor.IConfig>): void {\n let fullConfig: CodeMirrorEditor.IConfig = {\n ...CodeMirrorEditor.defaultConfig,\n ...config\n };\n let key: keyof CodeMirrorEditor.IConfig;\n for (key in fullConfig) {\n Private.setOption(editor, key, fullConfig[key]);\n }\n }\n\n /**\n * Indent or insert a tab as appropriate.\n */\n export\n function indentMoreOrinsertTab(cm: CodeMirror.Editor): void {\n let doc = cm.getDoc();\n let from = doc.getCursor('from');\n let to = doc.getCursor('to');\n let sel = !posEq(from, to);\n if (sel) {\n CodeMirror.commands['indentMore'](cm);\n return;\n }\n // Check for start of line.\n let line = doc.getLine(from.line);\n let before = line.slice(0, from.ch);\n if (/^\\s*$/.test(before)) {\n CodeMirror.commands['indentMore'](cm);\n } else {\n CodeMirror.commands['insertSoftTab'](cm);\n }\n }\n\n /**\n * Delete spaces to the previous tab stob in a codemirror editor.\n */\n export\n function delSpaceToPrevTabStop(cm: CodeMirror.Editor): void {\n let doc = cm.getDoc();\n let from = doc.getCursor('from');\n let to = doc.getCursor('to');\n let sel = !posEq(from, to);\n if (sel) {\n let ranges = doc.listSelections();\n for (let i = ranges.length - 1; i >= 0; i--) {\n let head = ranges[i].head;\n let anchor = ranges[i].anchor;\n doc.replaceRange('', CodeMirror.Pos(head.line, head.ch), CodeMirror.Pos(anchor.line, anchor.ch));\n }\n return;\n }\n let cur = doc.getCursor();\n let tabsize = cm.getOption('tabSize');\n let chToPrevTabStop = cur.ch - (Math.ceil(cur.ch / tabsize) - 1) * tabsize;\n from = {ch: cur.ch - chToPrevTabStop, line: cur.line};\n let select = doc.getRange(from, cur);\n if (select.match(/^\\ +$/) !== null) {\n doc.replaceRange('', from, cur);\n } else {\n CodeMirror.commands['delCharBefore'](cm);\n }\n }\n\n /**\n * Test whether two CodeMirror positions are equal.\n */\n export\n function posEq(a: CodeMirror.Position, b: CodeMirror.Position): boolean {\n return a.line === b.line && a.ch === b.ch;\n }\n\n /**\n * Get a config option for the editor.\n */\n export\n function getOption<K extends keyof CodeMirrorEditor.IConfig>(editor: CodeMirror.Editor, option: K): CodeMirrorEditor.IConfig[K] {\n switch (option) {\n case 'lineWrap':\n return editor.getOption('lineWrapping');\n case 'insertSpaces':\n return !editor.getOption('indentWithTabs');\n case 'tabSize':\n return editor.getOption('indentUnit');\n case 'autoClosingBrackets':\n return editor.getOption('autoCloseBrackets');\n default:\n return editor.getOption(option);\n }\n }\n\n /**\n * Set a config option for the editor.\n */\n export\n function setOption<K extends keyof CodeMirrorEditor.IConfig>(editor: CodeMirror.Editor, option: K, value: CodeMirrorEditor.IConfig[K]): void {\n // Don't bother setting the option if it is already the same.\n const oldValue = getOption(editor, option);\n if (oldValue === value) {\n return;\n }\n switch (option) {\n case 'lineWrap':\n editor.setOption('lineWrapping', value);\n break;\n case 'tabSize':\n editor.setOption('indentUnit', value);\n break;\n case 'insertSpaces':\n editor.setOption('indentWithTabs', !value);\n break;\n case 'autoClosingBrackets':\n editor.setOption('autoCloseBrackets', value);\n break;\n case 'readOnly':\n let el = editor.getWrapperElement();\n el.classList.toggle(READ_ONLY_CLASS, value);\n editor.setOption(option, value);\n break;\n default:\n editor.setOption(option, value);\n break;\n }\n }\n}\n\n\n/**\n * Add a CodeMirror command to delete until previous non blanking space\n * character or first multiple of tabsize tabstop.\n */\nCodeMirrorEditor.addCommand(\n 'delSpaceToPrevTabStop', Private.delSpaceToPrevTabStop\n);\n\n\n/**\n * Add a CodeMirror command to indent or insert a tab as appropriate.\n */\nCodeMirrorEditor.addCommand(\n 'indentMoreOrinsertTab', Private.indentMoreOrinsertTab\n);\n\n"]}
1
+ {"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../../codemirror/src/editor.ts"],"names":[],"mappings":";AAAA,0CAA0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AAC;QACD,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACjB,KAAK,UAAU;gBACb,MAAM,CAAC,SAAS,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;gBACxC,KAAK,CAAC;YACR,KAAK,SAAS;gBACZ,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;gBACtC,KAAK,CAAC;YACR,KAAK,cAAc;gBACjB,MAAM,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC,KAAK,CAAC,CAAC;gBAC3C,KAAK,CAAC;YACR,KAAK,qBAAqB;gBACxB,MAAM,CAAC,SAAS,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;gBAC7C,KAAK,CAAC;YACR,KAAK,UAAU;gBACb,IAAI,EAAE,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBACpC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;gBAC5C,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAChC,KAAK,CAAC;YACR;gBACE,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBAChC,KAAK,CAAC;QACR,CAAC;IACH,CAAC;IA5BQ,iBAAS,YA4BjB,CAAA;AACH,CAAC,EAjIS,OAAO,KAAP,OAAO,QAiIhB;AAGD;;;GAGG;AACH,gBAAgB,CAAC,UAAU,CACzB,uBAAuB,EAAE,OAAO,CAAC,qBAAqB,CACvD,CAAC;AAGF;;GAEG;AACH,gBAAgB,CAAC,UAAU,CACzB,uBAAuB,EAAE,OAAO,CAAC,qBAAqB,CACvD,CAAC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport * as CodeMirror\n from 'codemirror';\n\nimport {\n JSONExt\n} from '@phosphor/coreutils';\n\nimport {\n ArrayExt\n} from '@phosphor/algorithm';\n\nimport {\n IDisposable, DisposableDelegate\n} from '@phosphor/disposable';\n\nimport {\n Signal\n} from '@phosphor/signaling';\n\nimport {\n showDialog\n} from '@jupyterlab/apputils';\n\nimport {\n CodeEditor\n} from '@jupyterlab/codeeditor';\n\nimport {\n uuid\n} from '@jupyterlab/coreutils';\n\nimport {\n IObservableMap, IObservableString, ICollaborator\n} from '@jupyterlab/observables';\n\nimport {\n Mode\n} from './mode';\n\nimport 'codemirror/addon/comment/comment.js';\nimport 'codemirror/addon/edit/matchbrackets.js';\nimport 'codemirror/addon/edit/closebrackets.js';\nimport 'codemirror/addon/scroll/scrollpastend.js';\nimport 'codemirror/addon/search/searchcursor';\nimport 'codemirror/addon/search/search';\nimport 'codemirror/keymap/emacs.js';\nimport 'codemirror/keymap/sublime.js';\nimport 'codemirror/keymap/vim.js';\n\n\n/**\n * The class name added to CodeMirrorWidget instances.\n */\nconst EDITOR_CLASS = 'jp-CodeMirrorEditor';\n\n/**\n * The class name added to read only cell editor widgets.\n */\nconst READ_ONLY_CLASS = 'jp-mod-readOnly';\n\n/**\n * The class name for the hover box for collaborator cursors.\n */\nconst COLLABORATOR_CURSOR_CLASS = 'jp-CollaboratorCursor';\n\n/**\n * The class name for the hover box for collaborator cursors.\n */\nconst COLLABORATOR_HOVER_CLASS = 'jp-CollaboratorCursor-hover';\n\n/**\n * The key code for the up arrow key.\n */\nconst UP_ARROW = 38;\n\n/**\n * The key code for the down arrow key.\n */\nconst DOWN_ARROW = 40;\n\n/**\n * The time that a collaborator name hover persists.\n */\nconst HOVER_TIMEOUT = 1000;\n\n\n/**\n * CodeMirror editor.\n */\nexport\nclass CodeMirrorEditor implements CodeEditor.IEditor {\n /**\n * Construct a CodeMirror editor.\n */\n constructor(options: CodeMirrorEditor.IOptions) {\n let host = this.host = options.host;\n host.classList.add(EDITOR_CLASS);\n host.classList.add('jp-Editor');\n host.addEventListener('focus', this, true);\n host.addEventListener('blur', this, true);\n host.addEventListener('scroll', this, true);\n\n this._uuid = options.uuid || uuid();\n\n // Handle selection style.\n let style = options.selectionStyle || {};\n this._selectionStyle = {\n ...CodeEditor.defaultSelectionStyle,\n ...style as CodeEditor.ISelectionStyle\n };\n\n let model = this._model = options.model;\n let editor = this._editor = CodeMirror(host, {});\n Private.handleConfig(editor, options.config || {});\n\n let doc = editor.getDoc();\n\n // Handle initial values for text, mimetype, and selections.\n doc.setValue(model.value.text);\n this._onMimeTypeChanged();\n this._onCursorActivity();\n this._timer = window.setInterval(() => { this._checkSync(); }, 3000);\n\n // Connect to changes.\n model.value.changed.connect(this._onValueChanged, this);\n model.mimeTypeChanged.connect(this._onMimeTypeChanged, this);\n model.selections.changed.connect(this._onSelectionsChanged, this);\n\n CodeMirror.on(editor, 'keydown', (editor, event) => {\n let index = ArrayExt.findFirstIndex(this._keydownHandlers, handler => {\n if (handler(this, event) === true) {\n event.preventDefault();\n return true;\n }\n return false;\n });\n if (index === -1) {\n this.onKeydown(event);\n }\n });\n CodeMirror.on(editor, 'cursorActivity', () => this._onCursorActivity());\n CodeMirror.on(editor.getDoc(), 'beforeChange', (instance, change) => {\n this._beforeDocChanged(instance, change);\n });\n CodeMirror.on(editor.getDoc(), 'change', (instance, change) => {\n // Manually refresh after setValue to make sure editor is properly sized.\n if (change.origin === 'setValue' && this.hasFocus()) {\n this.refresh();\n }\n this._lastChange = change;\n });\n\n // Manually refresh on paste to make sure editor is properly sized.\n editor.getWrapperElement().addEventListener('paste', () => {\n if (this.hasFocus()) {\n this.refresh();\n }\n });\n }\n\n /**\n * A signal emitted when either the top or bottom edge is requested.\n */\n readonly edgeRequested = new Signal<this, CodeEditor.EdgeLocation>(this);\n\n /**\n * The DOM node that hosts the editor.\n */\n readonly host: HTMLElement;\n\n /**\n * The uuid of this editor;\n */\n get uuid(): string {\n return this._uuid;\n }\n set uuid(value: string) {\n this._uuid = value;\n }\n\n /**\n * The selection style of this editor.\n */\n get selectionStyle(): CodeEditor.ISelectionStyle {\n return this._selectionStyle;\n }\n set selectionStyle(value: CodeEditor.ISelectionStyle) {\n this._selectionStyle = value;\n }\n\n /**\n * Get the codemirror editor wrapped by the editor.\n */\n get editor(): CodeMirror.Editor {\n return this._editor;\n }\n\n /**\n * Get the codemirror doc wrapped by the widget.\n */\n get doc(): CodeMirror.Doc {\n return this._editor.getDoc();\n }\n\n /**\n * Get the number of lines in the editor.\n */\n get lineCount(): number {\n return this.doc.lineCount();\n }\n\n /**\n * Returns a model for this editor.\n */\n get model(): CodeEditor.IModel {\n return this._model;\n }\n\n /**\n * The height of a line in the editor in pixels.\n */\n get lineHeight(): number {\n return this._editor.defaultTextHeight();\n }\n\n /**\n * The widget of a character in the editor in pixels.\n */\n get charWidth(): number {\n return this._editor.defaultCharWidth();\n }\n\n /**\n * Tests whether the editor is disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose(): void {\n if (this.isDisposed) {\n return;\n }\n this._isDisposed = true;\n this.host.removeEventListener('focus', this, true);\n this.host.removeEventListener('blur', this, true);\n this.host.removeEventListener('scroll', this, true);\n this._keydownHandlers.length = 0;\n window.clearInterval(this._timer);\n Signal.clearData(this);\n }\n\n /**\n * Get a config option for the editor.\n */\n getOption<K extends keyof CodeMirrorEditor.IConfig>(option: K): CodeMirrorEditor.IConfig[K] {\n return Private.getOption(this.editor, option);\n }\n\n /**\n * Set a config option for the editor.\n */\n setOption<K extends keyof CodeMirrorEditor.IConfig>(option: K, value: CodeMirrorEditor.IConfig[K]): void {\n Private.setOption(this.editor, option, value);\n }\n\n /**\n * Returns the content for the given line number.\n */\n getLine(line: number): string | undefined {\n return this.doc.getLine(line);\n }\n\n /**\n * Find an offset for the given position.\n */\n getOffsetAt(position: CodeEditor.IPosition): number {\n return this.doc.indexFromPos({\n ch: position.column,\n line: position.line\n });\n }\n\n /**\n * Find a position fot the given offset.\n */\n getPositionAt(offset: number): CodeEditor.IPosition {\n const { ch, line } = this.doc.posFromIndex(offset);\n return { line, column: ch };\n }\n\n /**\n * Undo one edit (if any undo events are stored).\n */\n undo(): void {\n this.doc.undo();\n }\n\n /**\n * Redo one undone edit.\n */\n redo(): void {\n this.doc.redo();\n }\n\n /**\n * Clear the undo history.\n */\n clearHistory(): void {\n this.doc.clearHistory();\n }\n\n /**\n * Brings browser focus to this editor text.\n */\n focus(): void {\n this._editor.focus();\n }\n\n /**\n * Test whether the editor has keyboard focus.\n */\n hasFocus(): boolean {\n return this._editor.getWrapperElement().contains(document.activeElement);\n }\n\n /**\n * Explicitly blur the editor.\n */\n blur(): void {\n this._editor.getInputField().blur();\n }\n\n /**\n * Repaint editor.\n */\n refresh(): void {\n this._editor.refresh();\n this._needsRefresh = false;\n }\n\n /**\n * Refresh the editor if it is focused;\n * otherwise postpone refreshing till focusing.\n */\n resizeToFit(): void {\n if (this.hasFocus()) {\n this.refresh();\n } else {\n this._needsRefresh = true;\n }\n this._clearHover();\n }\n\n /**\n * Add a keydown handler to the editor.\n *\n * @param handler - A keydown handler.\n *\n * @returns A disposable that can be used to remove the handler.\n */\n addKeydownHandler(handler: CodeEditor.KeydownHandler): IDisposable {\n this._keydownHandlers.push(handler);\n return new DisposableDelegate(() => {\n ArrayExt.removeAllWhere(this._keydownHandlers, val => val === handler);\n });\n }\n\n /**\n * Set the size of the editor in pixels.\n */\n setSize(dimension: CodeEditor.IDimension | null): void {\n if (dimension) {\n this._editor.setSize(dimension.width, dimension.height);\n } else {\n this._editor.setSize(null, null);\n }\n this._needsRefresh = false;\n }\n\n /**\n * Reveal the given position in the editor.\n */\n revealPosition(position: CodeEditor.IPosition): void {\n const cmPosition = this._toCodeMirrorPosition(position);\n this._editor.scrollIntoView(cmPosition);\n }\n\n /**\n * Reveal the given selection in the editor.\n */\n revealSelection(selection: CodeEditor.IRange): void {\n const range = this._toCodeMirrorRange(selection);\n this._editor.scrollIntoView(range);\n }\n\n /**\n * Get the window coordinates given a cursor position.\n */\n getCoordinateForPosition(position: CodeEditor.IPosition): CodeEditor.ICoordinate {\n const pos = this._toCodeMirrorPosition(position);\n const rect = this.editor.charCoords(pos, 'page');\n return rect as CodeEditor.ICoordinate;\n }\n\n /**\n * Get the cursor position given window coordinates.\n *\n * @param coordinate - The desired coordinate.\n *\n * @returns The position of the coordinates, or null if not\n * contained in the editor.\n */\n getPositionForCoordinate(coordinate: CodeEditor.ICoordinate): CodeEditor.IPosition | null {\n return this._toPosition(this.editor.coordsChar(coordinate)) || null;\n }\n\n /**\n * Returns the primary position of the cursor, never `null`.\n */\n getCursorPosition(): CodeEditor.IPosition {\n const cursor = this.doc.getCursor();\n return this._toPosition(cursor);\n }\n\n /**\n * Set the primary position of the cursor.\n *\n * #### Notes\n * This will remove any secondary cursors.\n */\n setCursorPosition(position: CodeEditor.IPosition): void {\n const cursor = this._toCodeMirrorPosition(position);\n this.doc.setCursor(cursor);\n // If the editor does not have focus, this cursor change\n // will get screened out in _onCursorsChanged(). Make an\n // exception for this method.\n if (!this.editor.hasFocus()) {\n this.model.selections.set(this.uuid, this.getSelections());\n }\n }\n\n /**\n * Returns the primary selection, never `null`.\n */\n getSelection(): CodeEditor.ITextSelection {\n return this.getSelections()[0];\n }\n\n /**\n * Set the primary selection. This will remove any secondary cursors.\n */\n setSelection(selection: CodeEditor.IRange): void {\n this.setSelections([selection]);\n }\n\n /**\n * Gets the selections for all the cursors, never `null` or empty.\n */\n getSelections(): CodeEditor.ITextSelection[] {\n const selections = this.doc.listSelections();\n if (selections.length > 0) {\n return selections.map(selection => this._toSelection(selection));\n }\n const cursor = this.doc.getCursor();\n const selection = this._toSelection({ anchor: cursor, head: cursor });\n return [selection];\n }\n\n /**\n * Sets the selections for all the cursors, should not be empty.\n * Cursors will be removed or added, as necessary.\n * Passing an empty array resets a cursor position to the start of a document.\n */\n setSelections(selections: CodeEditor.IRange[]): void {\n const cmSelections = this._toCodeMirrorSelections(selections);\n this.doc.setSelections(cmSelections, 0);\n }\n\n newIndentedLine(): void {\n this.execCommand('newlineAndIndent');\n }\n\n /**\n * Execute a codemirror command on the editor.\n *\n * @param command - The name of the command to execute.\n */\n execCommand(command: string): void {\n this._editor.execCommand(command);\n }\n\n /**\n * Handle keydown events from the editor.\n */\n protected onKeydown(event: KeyboardEvent): boolean {\n let position = this.getCursorPosition();\n let { line, column } = position;\n\n if (line === 0 && column === 0 && event.keyCode === UP_ARROW) {\n if (!event.shiftKey) {\n this.edgeRequested.emit('top');\n }\n return false;\n }\n\n let lastLine = this.lineCount - 1;\n let lastCh = this.getLine(lastLine)!.length;\n if (line === lastLine && column === lastCh\n && event.keyCode === DOWN_ARROW) {\n if (!event.shiftKey) {\n this.edgeRequested.emit('bottom');\n }\n return false;\n }\n return false;\n }\n\n /**\n * Converts selections to code mirror selections.\n */\n private _toCodeMirrorSelections(selections: CodeEditor.IRange[]): CodeMirror.Selection[] {\n if (selections.length > 0) {\n return selections.map(selection => this._toCodeMirrorSelection(selection));\n }\n const position = { line: 0, ch: 0 };\n return [{ anchor: position, head: position }];\n }\n\n /**\n * Handles a mime type change.\n */\n private _onMimeTypeChanged(): void {\n const mime = this._model.mimeType;\n let editor = this._editor;\n Mode.ensure(mime).then(spec => {\n editor.setOption('mode', spec.mime);\n });\n let extraKeys = editor.getOption('extraKeys') || {};\n const isCode = (mime !== 'text/plain') && (mime !== 'text/x-ipythongfm');\n if (isCode) {\n extraKeys['Backspace'] = 'delSpaceToPrevTabStop';\n } else {\n delete extraKeys['Backspace'];\n }\n editor.setOption('extraKeys', extraKeys);\n }\n\n /**\n * Handles a selections change.\n */\n private _onSelectionsChanged(selections: IObservableMap<CodeEditor.ITextSelection[]>, args: IObservableMap.IChangedArgs<CodeEditor.ITextSelection[]>): void {\n const uuid = args.key;\n if (uuid !== this.uuid) {\n this._cleanSelections(uuid);\n if (args.type !== 'remove' && args.newValue) {\n this._markSelections(uuid, args.newValue);\n }\n }\n }\n\n /**\n * Clean selections for the given uuid.\n */\n private _cleanSelections(uuid: string) {\n const markers = this.selectionMarkers[uuid];\n if (markers) {\n markers.forEach(marker => { marker.clear(); });\n }\n delete this.selectionMarkers[uuid];\n }\n\n /**\n * Marks selections.\n */\n private _markSelections(uuid: string, selections: CodeEditor.ITextSelection[]) {\n const markers: CodeMirror.TextMarker[] = [];\n\n // If we are marking selections corresponding to an active hover,\n // remove it.\n if (uuid === this._hoverId) {\n this._clearHover();\n }\n // If we can id the selection to a specific collaborator,\n // use that information.\n let collaborator: ICollaborator | undefined;\n if (this._model.modelDB.collaborators) {\n collaborator = this._model.modelDB.collaborators.get(uuid);\n }\n\n // Style each selection for the uuid.\n selections.forEach(selection => {\n // Only render selections if the start is not equal to the end.\n // In that case, we don't need to render the cursor.\n if (!JSONExt.deepEqual(selection.start, selection.end)) {\n const { anchor, head } = this._toCodeMirrorSelection(selection);\n let markerOptions: CodeMirror.TextMarkerOptions;\n if (collaborator) {\n markerOptions = this._toTextMarkerOptions({\n ...selection.style,\n color: collaborator.color\n });\n } else {\n markerOptions = this._toTextMarkerOptions(selection.style);\n }\n markers.push(this.doc.markText(anchor, head, markerOptions));\n } else if (collaborator) {\n let caret = this._getCaret(collaborator);\n markers.push(this.doc.setBookmark(\n this._toCodeMirrorPosition(selection.end), {widget: caret}));\n }\n });\n this.selectionMarkers[uuid] = markers;\n }\n\n /**\n * Handles a cursor activity event.\n */\n private _onCursorActivity(): void {\n // Only add selections if the editor has focus. This avoids unwanted\n // triggering of cursor activity due to collaborator actions.\n if (this._editor.hasFocus()) {\n const selections = this.getSelections();\n this.model.selections.set(this.uuid, selections);\n }\n }\n\n /**\n * Converts a code mirror selection to an editor selection.\n */\n private _toSelection(selection: CodeMirror.Selection): CodeEditor.ITextSelection {\n return {\n uuid: this.uuid,\n start: this._toPosition(selection.anchor),\n end: this._toPosition(selection.head),\n style: this.selectionStyle\n };\n }\n\n /**\n * Converts the selection style to a text marker options.\n */\n private _toTextMarkerOptions(style: CodeEditor.ISelectionStyle): CodeMirror.TextMarkerOptions {\n let r = parseInt(style.color.slice(1, 3), 16);\n let g = parseInt(style.color.slice(3, 5), 16);\n let b = parseInt(style.color.slice(5, 7), 16);\n let css = `background-color: rgba( ${r}, ${g}, ${b}, 0.15)`;\n return {\n className: style.className,\n title: style.displayName,\n css\n };\n }\n\n /**\n * Converts an editor selection to a code mirror selection.\n */\n private _toCodeMirrorSelection(selection: CodeEditor.IRange): CodeMirror.Selection {\n // Selections only appear to render correctly if the anchor\n // is before the head in the document. That is, reverse selections\n // do not appear as intended.\n let forward: boolean = (selection.start.line < selection.end.line) ||\n (selection.start.line === selection.end.line &&\n selection.start.column <= selection.end.column);\n let anchor = forward ? selection.start : selection.end;\n let head = forward ? selection.end : selection.start;\n return {\n anchor: this._toCodeMirrorPosition(anchor),\n head: this._toCodeMirrorPosition(head)\n };\n }\n\n /**\n * Converts an editor selection to a code mirror selection.\n */\n private _toCodeMirrorRange(range: CodeEditor.IRange): CodeMirror.Range {\n return {\n from: this._toCodeMirrorPosition(range.start),\n to: this._toCodeMirrorPosition(range.end)\n };\n }\n\n /**\n * Convert a code mirror position to an editor position.\n */\n private _toPosition(position: CodeMirror.Position) {\n return {\n line: position.line,\n column: position.ch\n };\n }\n\n /**\n * Convert an editor position to a code mirror position.\n */\n private _toCodeMirrorPosition(position: CodeEditor.IPosition) {\n return {\n line: position.line,\n ch: position.column\n };\n }\n\n /**\n * Handle model value changes.\n */\n private _onValueChanged(value: IObservableString, args: IObservableString.IChangedArgs): void {\n if (this._changeGuard) {\n return;\n }\n this._changeGuard = true;\n let doc = this.doc;\n switch (args.type) {\n case 'insert':\n let pos = doc.posFromIndex(args.start);\n doc.replaceRange(args.value, pos, pos);\n break;\n case 'remove':\n let from = doc.posFromIndex(args.start);\n let to = doc.posFromIndex(args.end);\n doc.replaceRange('', from, to);\n break;\n case 'set':\n doc.setValue(args.value);\n break;\n default:\n break;\n }\n this._changeGuard = false;\n }\n\n /**\n * Handles document changes.\n */\n private _beforeDocChanged(doc: CodeMirror.Doc, change: CodeMirror.EditorChange) {\n if (this._changeGuard) {\n return;\n }\n this._changeGuard = true;\n let value = this._model.value;\n let start = doc.indexFromPos(change.from);\n let end = doc.indexFromPos(change.to);\n let inserted = change.text.join('\\n');\n\n if (end !== start) {\n value.remove(start, end);\n }\n if (inserted) {\n value.insert(start, inserted);\n }\n this._changeGuard = false;\n }\n\n /**\n * Handle the DOM events for the editor.\n *\n * @param event - The DOM event sent to the editor.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the editor's DOM node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'focus':\n this._evtFocus(event as FocusEvent);\n break;\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n case 'scroll':\n this._evtScroll();\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle `focus` events for the editor.\n */\n private _evtFocus(event: FocusEvent): void {\n if (this._needsRefresh) {\n this.refresh();\n }\n this.host.classList.add('jp-mod-focused');\n }\n\n /**\n * Handle `blur` events for the editor.\n */\n private _evtBlur(event: FocusEvent): void {\n this.host.classList.remove('jp-mod-focused');\n }\n\n /**\n * Handle `scroll` events for the editor.\n */\n private _evtScroll(): void {\n // Remove any active hover.\n this._clearHover();\n }\n\n /**\n * Clear the hover for a caret, due to things like\n * scrolling, resizing, deactivation, etc, where\n * the position is no longer valid.\n */\n private _clearHover(): void {\n if (this._caretHover) {\n window.clearTimeout(this._hoverTimeout);\n document.body.removeChild(this._caretHover);\n this._caretHover = null;\n }\n }\n\n /**\n * Construct a caret element representing the position\n * of a collaborator's cursor.\n */\n private _getCaret(collaborator: ICollaborator): HTMLElement {\n let name = collaborator ? collaborator.displayName : 'Anonymous';\n let color = collaborator ? collaborator.color : this._selectionStyle.color;\n let caret: HTMLElement = document.createElement('span');\n caret.className = COLLABORATOR_CURSOR_CLASS;\n caret.style.borderBottomColor = color;\n caret.onmouseenter = () => {\n this._clearHover();\n this._hoverId = collaborator.sessionId;\n let rect = caret.getBoundingClientRect();\n // Construct and place the hover box.\n let hover = document.createElement('div');\n hover.className = COLLABORATOR_HOVER_CLASS;\n hover.style.left = String(rect.left) + 'px';\n hover.style.top = String(rect.bottom) + 'px';\n hover.textContent = name;\n hover.style.backgroundColor = color;\n\n // If the user mouses over the hover, take over the timer.\n hover.onmouseenter = () => {\n window.clearTimeout(this._hoverTimeout);\n };\n hover.onmouseleave = () => {\n this._hoverTimeout = window.setTimeout(() => {\n this._clearHover();\n }, HOVER_TIMEOUT);\n };\n this._caretHover = hover;\n document.body.appendChild(hover);\n };\n caret.onmouseleave = () => {\n this._hoverTimeout = window.setTimeout(() => {\n this._clearHover();\n }, HOVER_TIMEOUT);\n };\n return caret;\n }\n\n /**\n * Check for an out of sync editor.\n */\n private _checkSync(): void {\n let change = this._lastChange;\n if (!change) {\n return;\n }\n this._lastChange = null;\n let editor = this._editor;\n let doc = editor.getDoc();\n if (doc.getValue() === this._model.value.text) {\n return;\n }\n\n showDialog({\n title: 'Code Editor out of Sync',\n body: 'Please open your browser JavaScript console for bug report instructions'\n });\n console.log('Please paste the following to https://github.com/jupyterlab/jupyterlab/issues/2951');\n console.log(JSON.stringify({\n model: this._model.value.text,\n view: doc.getValue(),\n selections: this.getSelections(),\n cursor: this.getCursorPosition(),\n lineSep: editor.getOption('lineSeparator'),\n mode: editor.getOption('mode'),\n change\n }));\n }\n\n private _model: CodeEditor.IModel;\n private _editor: CodeMirror.Editor;\n protected selectionMarkers: { [key: string]: CodeMirror.TextMarker[] | undefined } = {};\n private _caretHover: HTMLElement | null;\n private _hoverTimeout: number;\n private _hoverId: string;\n private _keydownHandlers = new Array<CodeEditor.KeydownHandler>();\n private _changeGuard = false;\n private _selectionStyle: CodeEditor.ISelectionStyle;\n private _uuid = '';\n private _needsRefresh = false;\n private _isDisposed = false;\n private _lastChange: CodeMirror.EditorChange | null = null;\n private _timer = -1;\n}\n\n\n/**\n * The namespace for `CodeMirrorEditor` statics.\n */\nexport\nnamespace CodeMirrorEditor {\n /**\n * The options used to initialize a code mirror editor.\n */\n export\n interface IOptions extends CodeEditor.IOptions {\n /**\n * The configuration options for the editor.\n */\n config?: Partial<IConfig>;\n }\n\n /**\n * The configuration options for a codemirror editor.\n */\n export\n interface IConfig extends CodeEditor.IConfig {\n /**\n * The mode to use.\n */\n mode?: string | Mode.IMode;\n\n /**\n * The theme to style the editor with.\n * You must make sure the CSS file defining the corresponding\n * .cm-s-[name] styles is loaded.\n */\n theme?: string;\n\n /**\n * Whether to use the context-sensitive indentation that the mode provides\n * (or just indent the same as the line before).\n */\n smartIndent?: boolean;\n\n /**\n * Configures whether the editor should re-indent the current line when a\n * character is typed that might change its proper indentation\n * (only works if the mode supports indentation).\n */\n electricChars?: boolean;\n\n /**\n * Configures the keymap to use. The default is \"default\", which is the\n * only keymap defined in codemirror.js itself.\n * Extra keymaps are found in the CodeMirror keymap directory.\n */\n keyMap?: string;\n\n /**\n * Can be used to specify extra keybindings for the editor, alongside the\n * ones defined by keyMap. Should be either null, or a valid keymap value.\n */\n extraKeys?: any;\n\n /**\n * Can be used to add extra gutters (beyond or instead of the line number\n * gutter).\n * Should be an array of CSS class names, each of which defines a width\n * (and optionally a background),\n * and which will be used to draw the background of the gutters.\n * May include the CodeMirror-linenumbers class, in order to explicitly\n * set the position of the line number gutter\n * (it will default to be to the right of all other gutters).\n * These class names are the keys passed to setGutterMarker.\n */\n gutters?: ReadonlyArray<string>;\n\n /**\n * Determines whether the gutter scrolls along with the content\n * horizontally (false)\n * or whether it stays fixed during horizontal scrolling (true,\n * the default).\n */\n fixedGutter?: boolean;\n\n /**\n * Whether the cursor should be drawn when a selection is active.\n */\n showCursorWhenSelecting?: boolean;\n\n /**\n * When fixedGutter is on, and there is a horizontal scrollbar, by default\n * the gutter will be visible to the left of this scrollbar. If this\n * option is set to true, it will be covered by an element with class\n * CodeMirror-gutter-filler.\n */\n coverGutterNextToScrollbar?: boolean;\n\n /**\n * Controls whether drag-and-drop is enabled.\n */\n dragDrop?: boolean;\n\n /**\n * Explicitly set the line separator for the editor.\n * By default (value null), the document will be split on CRLFs as well as\n * lone CRs and LFs, and a single LF will be used as line separator in all\n * output (such as getValue). When a specific string is given, lines will\n * only be split on that string, and output will, by default, use that\n * same separator.\n */\n lineSeparator?: string | null;\n\n /**\n * Chooses a scrollbar implementation. The default is \"native\", showing\n * native scrollbars. The core library also provides the \"null\" style,\n * which completely hides the scrollbars. Addons can implement additional\n * scrollbar models.\n */\n scrollbarStyle?: string;\n\n /**\n * When enabled, which is the default, doing copy or cut when there is no\n * selection will copy or cut the whole lines that have cursors on them.\n */\n lineWiseCopyCut?: boolean;\n\n /**\n * Whether to scroll past the end of the buffer.\n */\n scrollPastEnd?: boolean;\n }\n\n /**\n * The default configuration options for an editor.\n */\n export\n let defaultConfig: IConfig = {\n ...CodeEditor.defaultConfig,\n mode: 'null',\n theme: 'jupyter',\n smartIndent: true,\n electricChars: true,\n keyMap: 'default',\n extraKeys: null,\n gutters: Object.freeze([]),\n fixedGutter: true,\n showCursorWhenSelecting: false,\n coverGutterNextToScrollbar: false,\n dragDrop: true,\n lineSeparator: null,\n scrollbarStyle: 'native',\n lineWiseCopyCut: true,\n scrollPastEnd: false\n };\n\n /**\n * Add a command to CodeMirror.\n *\n * @param name - The name of the command to add.\n *\n * @param command - The command function.\n */\n export\n function addCommand(name: string, command: (cm: CodeMirror.Editor) => void) {\n CodeMirror.commands[name] = command;\n }\n}\n\n\n/**\n * The namespace for module private data.\n */\nnamespace Private {\n /**\n * Handle the codemirror configuration options.\n */\n export\n function handleConfig(editor: CodeMirror.Editor, config: Partial<CodeMirrorEditor.IConfig>): void {\n let fullConfig: CodeMirrorEditor.IConfig = {\n ...CodeMirrorEditor.defaultConfig,\n ...config\n };\n let key: keyof CodeMirrorEditor.IConfig;\n for (key in fullConfig) {\n Private.setOption(editor, key, fullConfig[key]);\n }\n }\n\n /**\n * Indent or insert a tab as appropriate.\n */\n export\n function indentMoreOrinsertTab(cm: CodeMirror.Editor): void {\n let doc = cm.getDoc();\n let from = doc.getCursor('from');\n let to = doc.getCursor('to');\n let sel = !posEq(from, to);\n if (sel) {\n CodeMirror.commands['indentMore'](cm);\n return;\n }\n // Check for start of line.\n let line = doc.getLine(from.line);\n let before = line.slice(0, from.ch);\n if (/^\\s*$/.test(before)) {\n CodeMirror.commands['indentMore'](cm);\n } else {\n CodeMirror.commands['insertSoftTab'](cm);\n }\n }\n\n /**\n * Delete spaces to the previous tab stob in a codemirror editor.\n */\n export\n function delSpaceToPrevTabStop(cm: CodeMirror.Editor): void {\n let doc = cm.getDoc();\n let from = doc.getCursor('from');\n let to = doc.getCursor('to');\n let sel = !posEq(from, to);\n if (sel) {\n let ranges = doc.listSelections();\n for (let i = ranges.length - 1; i >= 0; i--) {\n let head = ranges[i].head;\n let anchor = ranges[i].anchor;\n doc.replaceRange('', CodeMirror.Pos(head.line, head.ch), CodeMirror.Pos(anchor.line, anchor.ch));\n }\n return;\n }\n let cur = doc.getCursor();\n let tabsize = cm.getOption('tabSize');\n let chToPrevTabStop = cur.ch - (Math.ceil(cur.ch / tabsize) - 1) * tabsize;\n from = {ch: cur.ch - chToPrevTabStop, line: cur.line};\n let select = doc.getRange(from, cur);\n if (select.match(/^\\ +$/) !== null) {\n doc.replaceRange('', from, cur);\n } else {\n CodeMirror.commands['delCharBefore'](cm);\n }\n }\n\n /**\n * Test whether two CodeMirror positions are equal.\n */\n export\n function posEq(a: CodeMirror.Position, b: CodeMirror.Position): boolean {\n return a.line === b.line && a.ch === b.ch;\n }\n\n /**\n * Get a config option for the editor.\n */\n export\n function getOption<K extends keyof CodeMirrorEditor.IConfig>(editor: CodeMirror.Editor, option: K): CodeMirrorEditor.IConfig[K] {\n switch (option) {\n case 'lineWrap':\n return editor.getOption('lineWrapping');\n case 'insertSpaces':\n return !editor.getOption('indentWithTabs');\n case 'tabSize':\n return editor.getOption('indentUnit');\n case 'autoClosingBrackets':\n return editor.getOption('autoCloseBrackets');\n default:\n return editor.getOption(option);\n }\n }\n\n /**\n * Set a config option for the editor.\n */\n export\n function setOption<K extends keyof CodeMirrorEditor.IConfig>(editor: CodeMirror.Editor, option: K, value: CodeMirrorEditor.IConfig[K]): void {\n // Don't bother setting the option if it is already the same.\n const oldValue = getOption(editor, option);\n if (oldValue === value) {\n return;\n }\n switch (option) {\n case 'lineWrap':\n editor.setOption('lineWrapping', value);\n break;\n case 'tabSize':\n editor.setOption('indentUnit', value);\n break;\n case 'insertSpaces':\n editor.setOption('indentWithTabs', !value);\n break;\n case 'autoClosingBrackets':\n editor.setOption('autoCloseBrackets', value);\n break;\n case 'readOnly':\n let el = editor.getWrapperElement();\n el.classList.toggle(READ_ONLY_CLASS, value);\n editor.setOption(option, value);\n break;\n default:\n editor.setOption(option, value);\n break;\n }\n }\n}\n\n\n/**\n * Add a CodeMirror command to delete until previous non blanking space\n * character or first multiple of tabsize tabstop.\n */\nCodeMirrorEditor.addCommand(\n 'delSpaceToPrevTabStop', Private.delSpaceToPrevTabStop\n);\n\n\n/**\n * Add a CodeMirror command to indent or insert a tab as appropriate.\n */\nCodeMirrorEditor.addCommand(\n 'indentMoreOrinsertTab', Private.indentMoreOrinsertTab\n);\n"]}
package/lib/mimetype.js CHANGED
@@ -31,9 +31,13 @@ var CodeMirrorMimeTypeService = /** @class */ (function () {
31
31
  * If a mime type cannot be found returns the default mime type `text/plain`, never `null`.
32
32
  */
33
33
  CodeMirrorMimeTypeService.prototype.getMimeTypeByFilePath = function (path) {
34
- if (coreutils_1.PathExt.extname(path) === '.ipy') {
34
+ var ext = coreutils_1.PathExt.extname(path);
35
+ if (ext === '.ipy') {
35
36
  return 'text/x-python';
36
37
  }
38
+ else if (ext === '.md') {
39
+ return 'text/x-ipythongfm';
40
+ }
37
41
  var mode = mode_1.Mode.findByFileName(path) || mode_1.Mode.findBest('');
38
42
  return mode.mime;
39
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mimetype.js","sourceRoot":"","sources":["../../../../codemirror/src/mimetype.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAM3D,mDAE+B;AAE/B,+BAEgB;AAEhB;;GAEG;AACH;IAAA;IA8BA,CAAC;IA5BC;;;;;OAKG;IACH,yDAAqB,GAArB,UAAsB,IAAoC;QACxD,IAAI,GAAG,GAAG,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,WAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAsB,IAAI;YAClD,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACnC,CAAC,CAAC,IAAI,CAAC;IACV,CAAC;IAED;;;;;OAKG;IACH,yDAAqB,GAArB,UAAsB,IAAY;QAChC,EAAE,CAAC,CAAC,mBAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;YACrC,MAAM,CAAC,eAAe,CAAC;QACzB,CAAC;QACD,IAAI,IAAI,GAAG,WAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,WAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC1D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACH,gCAAC;AAAD,CAAC,AA9BD,IA8BC;AA7BK,8DAAyB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport {\n IEditorMimeTypeService\n} from '@jupyterlab/codeeditor';\n\nimport {\n nbformat, PathExt\n} from '@jupyterlab/coreutils';\n\nimport {\n Mode\n} from './mode';\n\n/**\n * The mime type service for CodeMirror.\n */\nexport\nclass CodeMirrorMimeTypeService implements IEditorMimeTypeService {\n /**\n * Returns a mime type for the given language info.\n *\n * #### Notes\n * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.\n */\n getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string {\n let ext = info.file_extension || '';\n return Mode.findBest(info.codemirror_mode as any || {\n mimetype: info.mimetype,\n name: info.name,\n ext: [ext.split('.').slice(-1)[0]]\n }).mime;\n }\n\n /**\n * Returns a mime type for the given file path.\n *\n * #### Notes\n * If a mime type cannot be found returns the default mime type `text/plain`, never `null`.\n */\n getMimeTypeByFilePath(path: string): string {\n if (PathExt.extname(path) === '.ipy') {\n return 'text/x-python';\n }\n let mode = Mode.findByFileName(path) || Mode.findBest('');\n return mode.mime;\n }\n}\n"]}
1
+ {"version":3,"file":"mimetype.js","sourceRoot":"","sources":["../../../../codemirror/src/mimetype.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAM3D,mDAE+B;AAE/B,+BAEgB;AAEhB;;GAEG;AACH;IAAA;IAiCA,CAAC;IA/BC;;;;;OAKG;IACH,yDAAqB,GAArB,UAAsB,IAAoC;QACxD,IAAI,GAAG,GAAG,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC;QACpC,MAAM,CAAC,WAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAsB,IAAI;YAClD,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACnC,CAAC,CAAC,IAAI,CAAC;IACV,CAAC;IAED;;;;;OAKG;IACH,yDAAqB,GAArB,UAAsB,IAAY;QAChC,IAAM,GAAG,GAAG,mBAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,EAAE,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC;YACnB,MAAM,CAAC,eAAe,CAAC;QACzB,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC;YACzB,MAAM,CAAC,mBAAmB,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,GAAG,WAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,WAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC1D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IACH,gCAAC;AAAD,CAAC,AAjCD,IAiCC;AAhCK,8DAAyB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport {\n IEditorMimeTypeService\n} from '@jupyterlab/codeeditor';\n\nimport {\n nbformat, PathExt\n} from '@jupyterlab/coreutils';\n\nimport {\n Mode\n} from './mode';\n\n/**\n * The mime type service for CodeMirror.\n */\nexport\nclass CodeMirrorMimeTypeService implements IEditorMimeTypeService {\n /**\n * Returns a mime type for the given language info.\n *\n * #### Notes\n * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.\n */\n getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string {\n let ext = info.file_extension || '';\n return Mode.findBest(info.codemirror_mode as any || {\n mimetype: info.mimetype,\n name: info.name,\n ext: [ext.split('.').slice(-1)[0]]\n }).mime;\n }\n\n /**\n * Returns a mime type for the given file path.\n *\n * #### Notes\n * If a mime type cannot be found returns the default mime type `text/plain`, never `null`.\n */\n getMimeTypeByFilePath(path: string): string {\n const ext = PathExt.extname(path);\n if (ext === '.ipy') {\n return 'text/x-python';\n } else if (ext === '.md') {\n return 'text/x-ipythongfm';\n }\n let mode = Mode.findByFileName(path) || Mode.findBest('');\n return mode.mime;\n }\n}\n"]}
package/lib/mode.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { JSONValue } from '@phosphor/coreutils';
1
2
  import 'codemirror/mode/meta';
2
3
  import 'codemirror/addon/runmode/runmode';
3
4
  import './codemirror-ipython';
@@ -15,7 +16,7 @@ import 'codemirror/mode/sql/sql';
15
16
  */
16
17
  export declare namespace Mode {
17
18
  /**
18
- * The interface of a codemirror mode spec.
19
+ * The interface of a codemirror modeInfo spec.
19
20
  */
20
21
  interface ISpec {
21
22
  ext?: string[];
@@ -23,6 +24,13 @@ export declare namespace Mode {
23
24
  mode: string;
24
25
  mime: string;
25
26
  }
27
+ /**
28
+ * The interface of a codemirror mode spec.
29
+ */
30
+ interface IMode {
31
+ name: string;
32
+ [key: string]: JSONValue;
33
+ }
26
34
  /**
27
35
  * Get the raw list of available modes specs.
28
36
  */
package/lib/mode.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mode.js","sourceRoot":"","sources":["../../../../codemirror/src/mode.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAE3D,qDAEgC;AAEhC,uCACoB;AAEpB,gCAA8B;AAC9B,4CAA0C;AAE1C,gCAA8B;AAC9B,mCAAiC;AAEjC,4BAA4B;AAC5B,iDAA+C;AAC/C,mCAAiC;AACjC,uCAAqC;AACrC,+BAA6B;AAC7B,6CAA2C;AAC3C,uCAAqC;AACrC,uCAAqC;AACrC,mCAAiC;AAEjC,mDAE+B;AAM/B;;GAEG;AACH,IACU,IAAI,CAgHb;AAjHD,WACU,IAAI;IAYZ;;OAEG;IACH;QAEE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAFQ,gBAAW,cAEnB,CAAA;IAED;;OAEG;IACH,aACa,IAAY,EAAE,IAAoB,EAAE,EAAe;QAC9D,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IACrC,CAAC;IAFQ,QAAG,MAEX,CAAA;IAED;;;;;;;OAOG;IACH,gBACgB,IAAoB;QAClC,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE1B,yCAAyC;QACzC,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QAED,iCAAiC;QACjC,MAAM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C;IACzC,CAAC;IAFQ,eAAU,aAElB,CAAA;IAED;;OAEG;IACH,wBACwB,IAAY;QAClC,IAAI,QAAQ,GAAG,mBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAHQ,mBAAc,iBAGtB,CAAA;IAED;;OAEG;IACH,yBACyB,GAAsB;QAC7C,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC;YAC5B,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;QACD,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,IAAI,IAAI,GAAG,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAClD,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gBACT,MAAM,CAAC,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAVQ,oBAAe,kBAUvB,CAAA;AACH,CAAC,EAhHS,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAgHb","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport {\n IEditorMimeTypeService\n} from '@jupyterlab/codeeditor';\n\nimport * as CodeMirror\n from 'codemirror';\n\nimport 'codemirror/mode/meta';\nimport 'codemirror/addon/runmode/runmode';\n\nimport './codemirror-ipython';\nimport './codemirror-ipythongfm';\n\n// Bundle other common modes\nimport 'codemirror/mode/javascript/javascript';\nimport 'codemirror/mode/css/css';\nimport 'codemirror/mode/julia/julia';\nimport 'codemirror/mode/r/r';\nimport 'codemirror/mode/markdown/markdown';\nimport 'codemirror/mode/clike/clike';\nimport 'codemirror/mode/shell/shell';\nimport 'codemirror/mode/sql/sql';\n\nimport {\n PathExt\n} from '@jupyterlab/coreutils';\n\n// Stub for the require function.\ndeclare var require: any;\n\n\n/**\n * The namespace for CodeMirror Mode functionality.\n */\nexport\nnamespace Mode {\n /**\n * The interface of a codemirror mode spec.\n */\n export\n interface ISpec {\n ext?: string[];\n name?: string;\n mode: string;\n mime: string;\n }\n\n /**\n * Get the raw list of available modes specs.\n */\n export\n function getModeInfo(): ISpec[] {\n return CodeMirror.modeInfo;\n }\n\n /**\n * Running a CodeMirror mode outside of an editor.\n */\n export\n function run(code: string, mode: string | ISpec, el: HTMLElement): void {\n CodeMirror.runMode(code, mode, el);\n }\n\n /**\n * Ensure a codemirror mode is available by name or Codemirror spec.\n *\n * @param mode - The mode to ensure. If it is a string, uses [findBest]\n * to get the appropriate spec.\n *\n * @returns A promise that resolves when the mode is available.\n */\n export\n function ensure(mode: string | ISpec): Promise<ISpec> {\n let spec = findBest(mode);\n\n // Simplest, cheapest check by mode name.\n if (CodeMirror.modes.hasOwnProperty(spec.mode)) {\n return Promise.resolve(spec);\n }\n\n // Fetch the mode asynchronously.\n return new Promise<ISpec>((resolve, reject) => {\n require([`codemirror/mode/${spec.mode}/${spec.mode}.js`], () => {\n resolve(spec);\n });\n });\n }\n\n /**\n * Find a codemirror mode by name or CodeMirror spec.\n */\n export\n function findBest(mode: string | ISpec): ISpec {\n let modename = (typeof mode === 'string') ? mode :\n mode.mode || mode.name;\n let mimetype = (typeof mode !== 'string') ? mode.mime : modename;\n let ext = (typeof mode !== 'string') ? mode.ext : [];\n\n return (\n CodeMirror.findModeByName(modename || '') ||\n CodeMirror.findModeByMIME(mimetype || '') ||\n findByExtension(ext) ||\n CodeMirror.findModeByMIME(IEditorMimeTypeService.defaultMimeType) ||\n CodeMirror.findModeByMIME('text/plain')\n );\n }\n\n /**\n * Find a codemirror mode by MIME.\n */\n export\n function findByMIME(mime: string): ISpec {\n return CodeMirror.findModeByMIME(mime);\n }\n\n /**\n * Find a codemirror mode by name.\n */\n export\n function findByName(name: string): ISpec {\n return CodeMirror.findModeByName(name);\n }\n\n /**\n * Find a codemirror mode by filename.\n */\n export\n function findByFileName(name: string): ISpec {\n let basename = PathExt.basename(name);\n return CodeMirror.findModeByFileName(basename);\n }\n\n /**\n * Find a codemirror mode by extension.\n */\n export\n function findByExtension(ext: string | string[]): ISpec {\n if (typeof ext === 'string') {\n return CodeMirror.findModeByExtension(name);\n }\n for (let i = 0; i < ext.length; i++) {\n let mode = CodeMirror.findModeByExtension(ext[i]);\n if (mode) {\n return mode;\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"mode.js","sourceRoot":"","sources":["../../../../codemirror/src/mode.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAM3D,qDAEgC;AAEhC,uCACoB;AAEpB,gCAA8B;AAC9B,4CAA0C;AAE1C,gCAA8B;AAC9B,mCAAiC;AAEjC,4BAA4B;AAC5B,iDAA+C;AAC/C,mCAAiC;AACjC,uCAAqC;AACrC,+BAA6B;AAC7B,6CAA2C;AAC3C,uCAAqC;AACrC,uCAAqC;AACrC,mCAAiC;AAEjC,mDAE+B;AAM/B;;GAEG;AACH,IACU,IAAI,CAyHb;AA1HD,WACU,IAAI;IAqBZ;;OAEG;IACH;QAEE,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAFQ,gBAAW,cAEnB,CAAA;IAED;;OAEG;IACH,aACa,IAAY,EAAE,IAAoB,EAAE,EAAe;QAC9D,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IACrC,CAAC;IAFQ,QAAG,MAEX,CAAA;IAED;;;;;;;OAOG;IACH,gBACgB,IAAoB;QAClC,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE1B,yCAAyC;QACzC,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC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AAU,aAElB,CAAA;IAED;;OAEG;IACH,oBACoB,IAAY;QAC9B,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAFQ,eAAU,aAElB,CAAA;IAED;;OAEG;IACH,wBACwB,IAAY;QAClC,IAAI,QAAQ,GAAG,mBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;IAHQ,mBAAc,iBAGtB,CAAA;IAED;;OAEG;IACH,yBACyB,GAAsB;QAC7C,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC;YAC5B,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;QACD,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,IAAI,IAAI,GAAG,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAClD,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gBACT,MAAM,CAAC,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAVQ,oBAAe,kBAUvB,CAAA;AACH,CAAC,EAzHS,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAyHb","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport {\n JSONValue\n} from '@phosphor/coreutils';\n\nimport {\n IEditorMimeTypeService\n} from '@jupyterlab/codeeditor';\n\nimport * as CodeMirror\n from 'codemirror';\n\nimport 'codemirror/mode/meta';\nimport 'codemirror/addon/runmode/runmode';\n\nimport './codemirror-ipython';\nimport './codemirror-ipythongfm';\n\n// Bundle other common modes\nimport 'codemirror/mode/javascript/javascript';\nimport 'codemirror/mode/css/css';\nimport 'codemirror/mode/julia/julia';\nimport 'codemirror/mode/r/r';\nimport 'codemirror/mode/markdown/markdown';\nimport 'codemirror/mode/clike/clike';\nimport 'codemirror/mode/shell/shell';\nimport 'codemirror/mode/sql/sql';\n\nimport {\n PathExt\n} from '@jupyterlab/coreutils';\n\n// Stub for the require function.\ndeclare var require: any;\n\n\n/**\n * The namespace for CodeMirror Mode functionality.\n */\nexport\nnamespace Mode {\n /**\n * The interface of a codemirror modeInfo spec.\n */\n export\n interface ISpec {\n ext?: string[];\n name?: string;\n mode: string;\n mime: string;\n }\n\n /**\n * The interface of a codemirror mode spec.\n */\n export\n interface IMode {\n name: string;\n [key: string]: JSONValue;\n }\n\n /**\n * Get the raw list of available modes specs.\n */\n export\n function getModeInfo(): ISpec[] {\n return CodeMirror.modeInfo;\n }\n\n /**\n * Running a CodeMirror mode outside of an editor.\n */\n export\n function run(code: string, mode: string | ISpec, el: HTMLElement): void {\n CodeMirror.runMode(code, mode, el);\n }\n\n /**\n * Ensure a codemirror mode is available by name or Codemirror spec.\n *\n * @param mode - The mode to ensure. If it is a string, uses [findBest]\n * to get the appropriate spec.\n *\n * @returns A promise that resolves when the mode is available.\n */\n export\n function ensure(mode: string | ISpec): Promise<ISpec> {\n let spec = findBest(mode);\n\n // Simplest, cheapest check by mode name.\n if (CodeMirror.modes.hasOwnProperty(spec.mode)) {\n return Promise.resolve(spec);\n }\n\n // Fetch the mode asynchronously.\n return new Promise<ISpec>((resolve, reject) => {\n require([`codemirror/mode/${spec.mode}/${spec.mode}.js`], () => {\n resolve(spec);\n });\n });\n }\n\n /**\n * Find a codemirror mode by name or CodeMirror spec.\n */\n export\n function findBest(mode: string | ISpec): ISpec {\n let modename = (typeof mode === 'string') ? mode :\n mode.mode || mode.name;\n let mimetype = (typeof mode !== 'string') ? mode.mime : modename;\n let ext = (typeof mode !== 'string') ? mode.ext : [];\n\n return (\n CodeMirror.findModeByName(modename || '') ||\n CodeMirror.findModeByMIME(mimetype || '') ||\n findByExtension(ext) ||\n CodeMirror.findModeByMIME(IEditorMimeTypeService.defaultMimeType) ||\n CodeMirror.findModeByMIME('text/plain')\n );\n }\n\n /**\n * Find a codemirror mode by MIME.\n */\n export\n function findByMIME(mime: string): ISpec {\n return CodeMirror.findModeByMIME(mime);\n }\n\n /**\n * Find a codemirror mode by name.\n */\n export\n function findByName(name: string): ISpec {\n return CodeMirror.findModeByName(name);\n }\n\n /**\n * Find a codemirror mode by filename.\n */\n export\n function findByFileName(name: string): ISpec {\n let basename = PathExt.basename(name);\n return CodeMirror.findModeByFileName(basename);\n }\n\n /**\n * Find a codemirror mode by extension.\n */\n export\n function findByExtension(ext: string | string[]): ISpec {\n if (typeof ext === 'string') {\n return CodeMirror.findModeByExtension(name);\n }\n for (let i = 0; i < ext.length; i++) {\n let mode = CodeMirror.findModeByExtension(ext[i]);\n if (mode) {\n return mode;\n }\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlab/codemirror",
3
- "version": "0.15.4",
3
+ "version": "0.16.3",
4
4
  "description": "JupyterLab - CodeMirror Editor Provider",
5
5
  "homepage": "https://github.com/jupyterlab/jupyterlab",
6
6
  "bugs": {
@@ -30,15 +30,15 @@
30
30
  "watch": "tsc -w"
31
31
  },
32
32
  "dependencies": {
33
- "@jupyterlab/apputils": "^0.15.4",
34
- "@jupyterlab/codeeditor": "^0.15.4",
35
- "@jupyterlab/coreutils": "^1.0.6",
36
- "@jupyterlab/observables": "^1.0.6",
33
+ "@jupyterlab/apputils": "^0.16.4",
34
+ "@jupyterlab/codeeditor": "^0.16.2",
35
+ "@jupyterlab/coreutils": "^1.1.3",
36
+ "@jupyterlab/observables": "^1.0.10",
37
37
  "@phosphor/algorithm": "^1.1.2",
38
38
  "@phosphor/coreutils": "^1.3.0",
39
39
  "@phosphor/disposable": "^1.1.2",
40
40
  "@phosphor/signaling": "^1.2.2",
41
- "codemirror": "~5.24.2"
41
+ "codemirror": "~5.35.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/codemirror": "~0.0.46",
package/style/index.css CHANGED
@@ -36,8 +36,9 @@
36
36
  }
37
37
 
38
38
 
39
- .CodeMirror-dialog {
39
+ .jp-CodeMirrorEditor[data-type="inline"] .CodeMirror-dialog {
40
40
  background-color: var(--jp-layout-color0);
41
+ color: var(--jp-content-font-color1);
41
42
  }
42
43
 
43
44
 
@@ -62,15 +63,14 @@
62
63
  cursor: text;
63
64
  }
64
65
 
65
-
66
- .CodeMirror-cursor {
66
+ .jp-CodeMirrorEditor[data-type="inline"] .CodeMirror-cursor {
67
67
  border-left: 1.4px solid var(--jp-editor-cursor-color);
68
68
  }
69
69
 
70
70
 
71
71
  /* When zoomed out 67% and 33% on a screen of 1440 width x 900 height */
72
72
  @media screen and (min-width: 2138px) and (max-width: 4319px) {
73
- .CodeMirror-cursor {
73
+ .jp-CodeMirrorEditor[data-type="inline"] .CodeMirror-cursor {
74
74
  border-left: 2px solid var(--jp-editor-cursor-color);
75
75
  }
76
76
  }
@@ -78,7 +78,7 @@
78
78
 
79
79
  /* When zoomed out less than 33% */
80
80
  @media screen and (min-width: 4320px) {
81
- .CodeMirror-cursor {
81
+ .jp-CodeMirrorEditor[data-type="inline"] .CodeMirror-cursor {
82
82
  border-left: 4px solid var(--jp-editor-cursor-color);
83
83
  }
84
84
  }