@neo4j-cypher/codemirror
Advanced tools
Comparing version 1.0.0-next.4 to 1.0.0-next.5
@@ -33,3 +33,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import { getStatePositionAbsolute, getStateEditorSupport, getStateLineCount, getStateValue, getStateLength, getStatePosition, getStatePositionForAny } from "./cypher-state-selectors"; | ||
import { fixColors, syntaxCSS, domListener, cypherLanguage, getReadableExtensions, getReadOnlyExtensions, getPlaceholderExtensions, getThemeExtensions, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getLintExtensions } from "./cypher-extensions"; | ||
import { fixColors, syntaxCSS, domListener, cypherLanguage, getReadableExtensions, getReadOnlyExtensions, getPlaceholderExtensions, getThemeExtensions, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getIndentWithTabExtensions, getLintExtensions } from "./cypher-extensions"; | ||
export * from "./cypher-codemirror-base"; | ||
@@ -45,2 +45,3 @@ export * from "./cypher-extensions"; | ||
historyConf = new Compartment(), | ||
indentWithTabConf = new Compartment(), | ||
placeholderConf = new Compartment(), | ||
@@ -58,2 +59,3 @@ themeConf = new Compartment(), | ||
history, | ||
indentWithTab, | ||
lineNumberFormatter, | ||
@@ -87,2 +89,4 @@ lineNumbers, | ||
history | ||
})), indentWithTabConf.of(getIndentWithTabExtensions({ | ||
indentWithTab | ||
})), readableConf.of(getReadableExtensions({ | ||
@@ -128,3 +132,4 @@ readOnly, | ||
readOnlyCursor, | ||
history | ||
history, | ||
indentWithTab | ||
} = combinedOptions; | ||
@@ -260,2 +265,3 @@ const { | ||
const historyConf = new Compartment(); | ||
const indentWithTabConf = new Compartment(); | ||
const placeholderConf = new Compartment(); | ||
@@ -274,2 +280,3 @@ const themeConf = new Compartment(); | ||
historyConf, | ||
indentWithTabConf, | ||
placeholderConf, | ||
@@ -543,2 +550,10 @@ themeConf, | ||
}; | ||
const setIndentWithTab = (newIndentWithTab = defaultOptions.indentWithTab) => { | ||
indentWithTab = newIndentWithTab; | ||
editor.dispatch({ | ||
effects: indentWithTabConf.reconfigure(getIndentWithTabExtensions({ | ||
indentWithTab | ||
})) | ||
}); | ||
}; | ||
const editorAPI = { | ||
@@ -557,2 +572,3 @@ clearHistory, | ||
setHistory, | ||
setIndentWithTab, | ||
setLineNumberFormatter, | ||
@@ -559,0 +575,0 @@ setLineNumbers, |
@@ -45,2 +45,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
history: true, | ||
indentWithTab: true, | ||
lineNumberFormatter: defaultLineNumberFormatter, | ||
@@ -61,3 +62,3 @@ lineNumbers: true, | ||
// "autofocus", | ||
"history", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", | ||
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", | ||
// "parseOnSetValue", | ||
@@ -64,0 +65,0 @@ "value"]; |
@@ -27,3 +27,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import { autocompletion as autocompletionExtension, completionKeymap } from "@codemirror/autocomplete"; | ||
import { history as historyExtension, defaultKeymap, historyKeymap } from "@codemirror/commands"; | ||
import { history as historyExtension, defaultKeymap, historyKeymap, indentWithTab } from "@codemirror/commands"; | ||
import { StreamLanguage, indentOnInput, foldKeymap, syntaxHighlighting, HighlightStyle } from "@codemirror/language"; | ||
@@ -230,2 +230,3 @@ import { linter, lintKeymap } from "@codemirror/lint"; | ||
export const historyExtensions = [historyExtension()]; | ||
export const indentWithTabExtensions = [keymap.of([indentWithTab])]; | ||
export const readableExtensions = [drawSelectionExtension(), EditorState.allowMultipleSelections.of(true), indentOnInput(), rectangularSelectionExtension(), crosshairCursorExtension(), keymap.of([...defaultKeymap, ...searchKeymap, ...historyKeymap, ...foldKeymap, ...completionKeymap, ...lintKeymap])]; | ||
@@ -279,2 +280,5 @@ export const readOnlyExtensions = [EditorState.readOnly.of(true)]; | ||
}) => history ? historyExtensions : []; | ||
export const getIndentWithTabExtensions = ({ | ||
indentWithTab | ||
}) => indentWithTab ? indentWithTabExtensions : []; | ||
export const getLintExtensions = ({ | ||
@@ -281,0 +285,0 @@ readOnly, |
@@ -54,2 +54,3 @@ "use strict"; | ||
historyConf = new _state.Compartment(), | ||
indentWithTabConf = new _state.Compartment(), | ||
placeholderConf = new _state.Compartment(), | ||
@@ -67,2 +68,3 @@ themeConf = new _state.Compartment(), | ||
history, | ||
indentWithTab, | ||
lineNumberFormatter, | ||
@@ -96,2 +98,4 @@ lineNumbers, | ||
history | ||
})), indentWithTabConf.of((0, _cypherExtensions.getIndentWithTabExtensions)({ | ||
indentWithTab | ||
})), readableConf.of((0, _cypherExtensions.getReadableExtensions)({ | ||
@@ -139,3 +143,4 @@ readOnly, | ||
readOnlyCursor, | ||
history | ||
history, | ||
indentWithTab | ||
} = combinedOptions; | ||
@@ -271,2 +276,3 @@ const { | ||
const historyConf = new _state.Compartment(); | ||
const indentWithTabConf = new _state.Compartment(); | ||
const placeholderConf = new _state.Compartment(); | ||
@@ -285,2 +291,3 @@ const themeConf = new _state.Compartment(); | ||
historyConf, | ||
indentWithTabConf, | ||
placeholderConf, | ||
@@ -554,2 +561,10 @@ themeConf, | ||
}; | ||
const setIndentWithTab = (newIndentWithTab = defaultOptions.indentWithTab) => { | ||
indentWithTab = newIndentWithTab; | ||
editor.dispatch({ | ||
effects: indentWithTabConf.reconfigure((0, _cypherExtensions.getIndentWithTabExtensions)({ | ||
indentWithTab | ||
})) | ||
}); | ||
}; | ||
const editorAPI = { | ||
@@ -568,2 +583,3 @@ clearHistory, | ||
setHistory, | ||
setIndentWithTab, | ||
setLineNumberFormatter, | ||
@@ -570,0 +586,0 @@ setLineNumbers, |
@@ -56,2 +56,3 @@ "use strict"; | ||
history: true, | ||
indentWithTab: true, | ||
lineNumberFormatter: defaultLineNumberFormatter, | ||
@@ -73,3 +74,3 @@ lineNumbers: true, | ||
// "autofocus", | ||
"history", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", | ||
"history", "indentWithTab", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "theme", | ||
// "parseOnSetValue", | ||
@@ -76,0 +77,0 @@ "value"]; |
@@ -7,3 +7,3 @@ "use strict"; | ||
}); | ||
exports.useStickyAutocompleteExtensions = exports.useNoLintExtensions = exports.useLintExtensions = exports.useAutocompleteExtensions = exports.syntaxCSS = exports.readableExtensions = exports.readOnlyNoCursorExtensions = exports.readOnlyExtensions = exports.lineWrappingExtensions = exports.historyExtensions = exports.getThemeExtensions = exports.getReadableExtensions = exports.getReadOnlyExtensions = exports.getPlaceholderExtensions = exports.getLintExtensions = exports.getLineWrappingExtensions = exports.getLineNumbersExtensions = exports.getHistoryExtensions = exports.getAutocompleteExtensions = exports.fixColors = exports.domListener = exports.cypherLinter = exports.cypherLineNumbers = exports.cypherLanguage = exports.cypherCompletion = void 0; | ||
exports.useStickyAutocompleteExtensions = exports.useNoLintExtensions = exports.useLintExtensions = exports.useAutocompleteExtensions = exports.syntaxCSS = exports.readableExtensions = exports.readOnlyNoCursorExtensions = exports.readOnlyExtensions = exports.lineWrappingExtensions = exports.indentWithTabExtensions = exports.historyExtensions = exports.getThemeExtensions = exports.getReadableExtensions = exports.getReadOnlyExtensions = exports.getPlaceholderExtensions = exports.getLintExtensions = exports.getLineWrappingExtensions = exports.getLineNumbersExtensions = exports.getIndentWithTabExtensions = exports.getHistoryExtensions = exports.getAutocompleteExtensions = exports.fixColors = exports.domListener = exports.cypherLinter = exports.cypherLineNumbers = exports.cypherLanguage = exports.cypherCompletion = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -224,2 +224,4 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
exports.historyExtensions = historyExtensions; | ||
const indentWithTabExtensions = [_view.keymap.of([_commands.indentWithTab])]; | ||
exports.indentWithTabExtensions = indentWithTabExtensions; | ||
const readableExtensions = [(0, _view.drawSelection)(), _state.EditorState.allowMultipleSelections.of(true), (0, _language.indentOnInput)(), (0, _view.rectangularSelection)(), (0, _view.crosshairCursor)(), _view.keymap.of([..._commands.defaultKeymap, ..._search.searchKeymap, ..._commands.historyKeymap, ..._language.foldKeymap, ..._autocomplete.completionKeymap, ..._lint.lintKeymap])]; | ||
@@ -288,2 +290,6 @@ exports.readableExtensions = readableExtensions; | ||
exports.getHistoryExtensions = getHistoryExtensions; | ||
const getIndentWithTabExtensions = ({ | ||
indentWithTab | ||
}) => indentWithTab ? indentWithTabExtensions : []; | ||
exports.getIndentWithTabExtensions = getIndentWithTabExtensions; | ||
const getLintExtensions = ({ | ||
@@ -290,0 +296,0 @@ readOnly, |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.0.0-next.4", | ||
"version": "1.0.0-next.5", | ||
"author": "Neo4j Inc.", | ||
@@ -12,0 +12,0 @@ "license": "GPL-3.0", |
@@ -269,2 +269,6 @@ /** | ||
/** | ||
* Set whether pressing the tab key affects editor indentation | ||
*/ | ||
setIndentWithTab(indentWithTab: boolean): void; | ||
/** | ||
* Set the formatter for the line numbers of the editor | ||
@@ -451,2 +455,8 @@ */ | ||
/** | ||
* Whether pressing the tab key affects editor indentation | ||
* | ||
* @defaultValue true | ||
*/ | ||
indentWithTab?: boolean; | ||
/** | ||
* The formatter for the line numbers of the editor | ||
@@ -453,0 +463,0 @@ * |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142072
3462