@neo4j-cypher/codemirror
Advanced tools
Comparing version 1.0.0-next.10 to 1.0.0-next.11
@@ -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, getTooltipAbsoluteExtensions, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getTabKeyExtensions, getLintExtensions } from "./cypher-extensions"; | ||
import { fixColors, syntaxCSS, domListener, cypherLanguage, getReadableExtensions, getReadOnlyExtensions, getPlaceholderExtensions, getSearchExtensions, getThemeExtensions, getTooltipAbsoluteExtensions, getLineNumbersExtensions, getAutocompleteExtensions, getLineWrappingExtensions, getHistoryExtensions, getTabKeyExtensions, getLintExtensions } from "./cypher-extensions"; | ||
export * from "./cypher-codemirror-base"; | ||
@@ -56,2 +56,3 @@ export * from "./cypher-extensions"; | ||
placeholderConf = new Compartment(), | ||
searchConf = new Compartment(), | ||
tabKeyConf = new Compartment(), | ||
@@ -71,2 +72,3 @@ themeConf = new Compartment(), | ||
tabKey, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -79,2 +81,4 @@ lineNumbers, | ||
readOnlyCursor, | ||
search, | ||
searchTop, | ||
theme, | ||
@@ -103,3 +107,4 @@ tooltipAbsolute | ||
})), tabKeyConf.of(getTabKeyExtensions({ | ||
tabKey | ||
tabKey, | ||
indentUnit | ||
})), readableConf.of(getReadableExtensions({ | ||
@@ -112,2 +117,6 @@ readOnly, | ||
theme | ||
})), searchConf.of(getSearchExtensions({ | ||
readOnly, | ||
search, | ||
searchTop | ||
})), tooltipAbsoluteConf.of(getTooltipAbsoluteExtensions({ | ||
@@ -141,2 +150,3 @@ tooltipAbsolute | ||
history, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -149,5 +159,8 @@ lineNumbers, | ||
readOnlyCursor, | ||
search, | ||
searchTop, | ||
tabKey, | ||
tooltipAbsolute | ||
} = combinedOptions; | ||
let lastPosition = null; | ||
const { | ||
@@ -195,2 +208,5 @@ on: onValueChanged, | ||
const positionChanged = positionObject => { | ||
lastPosition = (positionObject || { | ||
position: null | ||
}).position; | ||
firePositionChanged(positionOldToNew(positionObject)); | ||
@@ -284,2 +300,3 @@ }; | ||
const placeholderConf = new Compartment(); | ||
const searchConf = new Compartment(); | ||
const tabKeyConf = new Compartment(); | ||
@@ -301,2 +318,3 @@ const themeConf = new Compartment(); | ||
placeholderConf, | ||
searchConf, | ||
themeConf, | ||
@@ -333,8 +351,10 @@ tooltipAbsoluteConf, | ||
} = positionObject; | ||
editor.dispatch(editor.state.update({ | ||
scrollIntoView, | ||
selection: { | ||
anchor: position | ||
} | ||
})); | ||
if (position !== lastPosition) { | ||
editor.dispatch(editor.state.update({ | ||
scrollIntoView, | ||
selection: { | ||
anchor: position | ||
} | ||
})); | ||
} | ||
} | ||
@@ -361,2 +381,5 @@ }; | ||
} | ||
lastPosition = (getStatePosition(editor.state) || { | ||
position: null | ||
}).position; | ||
if (schema !== undefined) { | ||
@@ -584,6 +607,36 @@ editorSupport.setSchema(schema); | ||
effects: tabKeyConf.reconfigure(getTabKeyExtensions({ | ||
tabKey | ||
tabKey, | ||
indentUnit | ||
})) | ||
}); | ||
}; | ||
const setIndentUnit = (newIndentUnit = defaultOptions.indentUnit) => { | ||
indentUnit = newIndentUnit; | ||
editor.dispatch({ | ||
effects: tabKeyConf.reconfigure(getTabKeyExtensions({ | ||
tabKey, | ||
indentUnit | ||
})) | ||
}); | ||
}; | ||
const setSearch = (newSearch = defaultOptions.search) => { | ||
search = newSearch; | ||
editor.dispatch({ | ||
effects: searchConf.reconfigure(getSearchExtensions({ | ||
readOnly, | ||
search, | ||
searchTop | ||
})) | ||
}); | ||
}; | ||
const setSearchTop = (newSearchTop = defaultOptions.searchTop) => { | ||
searchTop = newSearchTop; | ||
editor.dispatch({ | ||
effects: searchConf.reconfigure(getSearchExtensions({ | ||
readOnly, | ||
search, | ||
searchTop | ||
})) | ||
}); | ||
}; | ||
const editorAPI = { | ||
@@ -602,2 +655,3 @@ clearHistory, | ||
setHistory, | ||
setIndentUnit, | ||
setLineNumberFormatter, | ||
@@ -612,2 +666,4 @@ setLineNumbers, | ||
setSchema, | ||
setSearch, | ||
setSearchTop, | ||
setTabKey, | ||
@@ -614,0 +670,0 @@ setTheme, |
@@ -45,2 +45,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
history: true, | ||
indentUnit: " ", | ||
lineNumberFormatter: defaultLineNumberFormatter, | ||
@@ -56,2 +57,4 @@ lineNumbers: true, | ||
schema: undefined, | ||
search: true, | ||
searchTop: false, | ||
tabKey: true, | ||
@@ -64,3 +67,3 @@ theme: THEME_LIGHT, | ||
// "autofocus", | ||
"history", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "tabKey", "theme", "tooltipAbsolute", | ||
"history", "indentUnit", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "search", "searchTop", "tabKey", "theme", "tooltipAbsolute", | ||
// "parseOnSetValue", | ||
@@ -67,0 +70,0 @@ "value"]; |
@@ -27,6 +27,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import { autocompletion as autocompletionExtension, completionKeymap, completionStatus, acceptCompletion } from "@codemirror/autocomplete"; | ||
import { history as historyExtension, defaultKeymap, historyKeymap, indentMore, indentLess, insertTab } from "@codemirror/commands"; | ||
import { StreamLanguage, indentOnInput, foldKeymap, syntaxHighlighting, HighlightStyle } from "@codemirror/language"; | ||
import { history as historyExtension, defaultKeymap, historyKeymap, indentMore, indentLess } from "@codemirror/commands"; | ||
import { StreamLanguage, indentOnInput, foldKeymap, syntaxHighlighting, HighlightStyle, indentUnit as indentUnitExtension } from "@codemirror/language"; | ||
import { linter, lintKeymap } from "@codemirror/lint"; | ||
import { searchKeymap } from "@codemirror/search"; | ||
import { searchKeymap, search } from "@codemirror/search"; | ||
import { EditorState, StateEffect } from "@codemirror/state"; | ||
@@ -39,3 +39,3 @@ import { EditorView, lineNumbers as lineNumbersExtension, drawSelection as drawSelectionExtension, rectangularSelection as rectangularSelectionExtension, crosshairCursor as crosshairCursorExtension, keymap, placeholder as placeholderExtension, tooltips } from "@codemirror/view"; | ||
import { typeMarkerField, addTypeMarkerEffect, clearTypeMarkersEffect } from "./cypher-state-definitions"; | ||
import { getStateEditorSupport, getStateLineCount, getStateValue, getStatePositionAbsoluteForLineColumn, getStatePositionForAbsolute, getStatePositionAnchor } from "./cypher-state-selectors"; | ||
import { getStateEditorSupport, getStateLineCount, getStateValue, getStatePositionAbsoluteForLineColumn, getStatePositionForAbsolute, getStateHasSelection } from "./cypher-state-selectors"; | ||
const typeMarkerTheme = EditorView.baseTheme({ | ||
@@ -240,35 +240,32 @@ // ".cm-underline": { textDecoration: "underline 3px red" } | ||
})]; | ||
export const historyExtensions = [historyExtension()]; | ||
const whitespaceRegex = /[\s]/; | ||
export const isAtStartOfLine = state => { | ||
const positionObject = getStatePositionAnchor(state); | ||
const value = getStateValue(state); | ||
const lineStart = positionObject.position - positionObject.column; | ||
for (let i = 0; i < positionObject.column; i++) { | ||
if (!whitespaceRegex.test(value.charAt(lineStart + i))) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
const runTab = (view, event) => { | ||
const status = completionStatus(view.state); | ||
const runTab = view => { | ||
const { | ||
state, | ||
dispatch | ||
} = view; | ||
const status = completionStatus(state); | ||
if (status === null) { | ||
if (isAtStartOfLine(view.state)) { | ||
indentMore(view); | ||
if (getStateHasSelection(state)) { | ||
return indentMore(view); | ||
} else { | ||
insertTab(view); | ||
dispatch(state.update(state.replaceSelection(state.facet(indentUnitExtension)), { | ||
scrollIntoView: true, | ||
userEvent: "input" | ||
})); | ||
return true; | ||
} | ||
event && event.preventDefault(); | ||
} else if (status === "active") { | ||
acceptCompletion(view); | ||
event && event.preventDefault(); | ||
return acceptCompletion(view); | ||
} | ||
return false; | ||
}; | ||
const shiftTab = (view, event) => { | ||
const status = completionStatus(view.state); | ||
if (status === null && isAtStartOfLine(view.state)) { | ||
indentLess(view); | ||
event && event.preventDefault(); | ||
const shiftTab = view => { | ||
const { | ||
state | ||
} = view; | ||
const status = completionStatus(state); | ||
if (status === null && getStateHasSelection(state)) { | ||
return indentLess(view); | ||
} | ||
return false; | ||
}; | ||
@@ -280,14 +277,21 @@ export const tabKeyExtensions = [keymap.of([{ | ||
}])]; | ||
export const readableExtensions = [drawSelectionExtension(), EditorState.allowMultipleSelections.of(true), indentOnInput(), rectangularSelectionExtension(), crosshairCursorExtension(), keymap.of([...defaultKeymap, ...searchKeymap, ...historyKeymap, ...foldKeymap, ...completionKeymap, ...lintKeymap])]; | ||
export const historyExtensions = [historyExtension(), keymap.of(historyKeymap)]; | ||
const searchTopExtensions = [search({ | ||
top: true | ||
}), keymap.of(searchKeymap)]; | ||
const searchBottomExtensions = [search({ | ||
top: false | ||
}), keymap.of(searchKeymap)]; | ||
export const readableExtensions = [drawSelectionExtension(), EditorState.allowMultipleSelections.of(true), indentOnInput(), rectangularSelectionExtension(), crosshairCursorExtension(), keymap.of([...defaultKeymap, ...foldKeymap])]; | ||
export const readOnlyExtensions = [EditorState.readOnly.of(true)]; | ||
export const readOnlyNoCursorExtensions = [EditorState.readOnly.of(true), EditorView.editable.of(false)]; | ||
export const lineWrappingExtensions = [EditorView.lineWrapping]; | ||
export const useLintExtensions = [cypherLinter()]; | ||
export const useLintExtensions = [cypherLinter(), keymap.of(lintKeymap)]; | ||
export const useNoLintExtensions = [cypherLinter({ | ||
showErrors: false | ||
})]; | ||
export const useAutocompleteExtensions = [cypherCompletion()]; | ||
export const useAutocompleteExtensions = [cypherCompletion(), keymap.of(completionKeymap)]; | ||
export const useStickyAutocompleteExtensions = [cypherCompletion({ | ||
closeOnBlur: false | ||
})]; | ||
}), keymap.of(completionKeymap)]; | ||
@@ -331,7 +335,13 @@ // GETTERS | ||
export const getTabKeyExtensions = ({ | ||
tabKey | ||
}) => tabKey ? tabKeyExtensions : []; | ||
tabKey, | ||
indentUnit | ||
}) => tabKey ? tabKeyExtensions.concat(indentUnitExtension.of(indentUnit)) : []; | ||
export const getThemeExtensions = ({ | ||
theme | ||
}) => theme === THEME_DARK ? darkExtensions : lightExtensions; | ||
export const getSearchExtensions = ({ | ||
readOnly, | ||
search, | ||
searchTop | ||
}) => search ? searchTop ? searchTopExtensions : searchBottomExtensions : []; | ||
export const getTooltipAbsoluteExtensions = ({ | ||
@@ -338,0 +348,0 @@ tooltipAbsolute |
@@ -101,2 +101,3 @@ /* | ||
return position; | ||
}; | ||
}; | ||
export const getStateHasSelection = state => state.selection.ranges.some(r => !r.empty); |
@@ -68,2 +68,3 @@ "use strict"; | ||
placeholderConf = new _state.Compartment(), | ||
searchConf = new _state.Compartment(), | ||
tabKeyConf = new _state.Compartment(), | ||
@@ -83,2 +84,3 @@ themeConf = new _state.Compartment(), | ||
tabKey, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -91,2 +93,4 @@ lineNumbers, | ||
readOnlyCursor, | ||
search, | ||
searchTop, | ||
theme, | ||
@@ -115,3 +119,4 @@ tooltipAbsolute | ||
})), tabKeyConf.of((0, _cypherExtensions.getTabKeyExtensions)({ | ||
tabKey | ||
tabKey, | ||
indentUnit | ||
})), readableConf.of((0, _cypherExtensions.getReadableExtensions)({ | ||
@@ -124,2 +129,6 @@ readOnly, | ||
theme | ||
})), searchConf.of((0, _cypherExtensions.getSearchExtensions)({ | ||
readOnly, | ||
search, | ||
searchTop | ||
})), tooltipAbsoluteConf.of((0, _cypherExtensions.getTooltipAbsoluteExtensions)({ | ||
@@ -154,2 +163,3 @@ tooltipAbsolute | ||
history, | ||
indentUnit, | ||
lineNumberFormatter, | ||
@@ -162,5 +172,8 @@ lineNumbers, | ||
readOnlyCursor, | ||
search, | ||
searchTop, | ||
tabKey, | ||
tooltipAbsolute | ||
} = combinedOptions; | ||
let lastPosition = null; | ||
const { | ||
@@ -208,2 +221,5 @@ on: onValueChanged, | ||
const positionChanged = positionObject => { | ||
lastPosition = (positionObject || { | ||
position: null | ||
}).position; | ||
firePositionChanged((0, _cypherCodemirrorBase.positionOldToNew)(positionObject)); | ||
@@ -297,2 +313,3 @@ }; | ||
const placeholderConf = new _state.Compartment(); | ||
const searchConf = new _state.Compartment(); | ||
const tabKeyConf = new _state.Compartment(); | ||
@@ -314,2 +331,3 @@ const themeConf = new _state.Compartment(); | ||
placeholderConf, | ||
searchConf, | ||
themeConf, | ||
@@ -346,8 +364,10 @@ tooltipAbsoluteConf, | ||
} = positionObject; | ||
editor.dispatch(editor.state.update({ | ||
scrollIntoView, | ||
selection: { | ||
anchor: position | ||
} | ||
})); | ||
if (position !== lastPosition) { | ||
editor.dispatch(editor.state.update({ | ||
scrollIntoView, | ||
selection: { | ||
anchor: position | ||
} | ||
})); | ||
} | ||
} | ||
@@ -374,2 +394,5 @@ }; | ||
} | ||
lastPosition = ((0, _cypherStateSelectors.getStatePosition)(editor.state) || { | ||
position: null | ||
}).position; | ||
if (schema !== undefined) { | ||
@@ -597,6 +620,36 @@ editorSupport.setSchema(schema); | ||
effects: tabKeyConf.reconfigure((0, _cypherExtensions.getTabKeyExtensions)({ | ||
tabKey | ||
tabKey, | ||
indentUnit | ||
})) | ||
}); | ||
}; | ||
const setIndentUnit = (newIndentUnit = defaultOptions.indentUnit) => { | ||
indentUnit = newIndentUnit; | ||
editor.dispatch({ | ||
effects: tabKeyConf.reconfigure((0, _cypherExtensions.getTabKeyExtensions)({ | ||
tabKey, | ||
indentUnit | ||
})) | ||
}); | ||
}; | ||
const setSearch = (newSearch = defaultOptions.search) => { | ||
search = newSearch; | ||
editor.dispatch({ | ||
effects: searchConf.reconfigure((0, _cypherExtensions.getSearchExtensions)({ | ||
readOnly, | ||
search, | ||
searchTop | ||
})) | ||
}); | ||
}; | ||
const setSearchTop = (newSearchTop = defaultOptions.searchTop) => { | ||
searchTop = newSearchTop; | ||
editor.dispatch({ | ||
effects: searchConf.reconfigure((0, _cypherExtensions.getSearchExtensions)({ | ||
readOnly, | ||
search, | ||
searchTop | ||
})) | ||
}); | ||
}; | ||
const editorAPI = { | ||
@@ -615,2 +668,3 @@ clearHistory, | ||
setHistory, | ||
setIndentUnit, | ||
setLineNumberFormatter, | ||
@@ -625,2 +679,4 @@ setLineNumbers, | ||
setSchema, | ||
setSearch, | ||
setSearchTop, | ||
setTabKey, | ||
@@ -627,0 +683,0 @@ setTheme, |
@@ -56,2 +56,3 @@ "use strict"; | ||
history: true, | ||
indentUnit: " ", | ||
lineNumberFormatter: defaultLineNumberFormatter, | ||
@@ -67,2 +68,4 @@ lineNumbers: true, | ||
schema: undefined, | ||
search: true, | ||
searchTop: false, | ||
tabKey: true, | ||
@@ -76,3 +79,3 @@ theme: THEME_LIGHT, | ||
// "autofocus", | ||
"history", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "tabKey", "theme", "tooltipAbsolute", | ||
"history", "indentUnit", "lineNumberFormatter", "lineNumbers", "lineWrapping", "lint", "placeholder", "position", "readOnly", "readOnlyCursor", "schema", "search", "searchTop", "tabKey", "theme", "tooltipAbsolute", | ||
// "parseOnSetValue", | ||
@@ -79,0 +82,0 @@ "value"]; |
@@ -7,3 +7,3 @@ "use strict"; | ||
}); | ||
exports.useStickyAutocompleteExtensions = exports.useNoLintExtensions = exports.useLintExtensions = exports.useAutocompleteExtensions = exports.tabKeyExtensions = exports.syntaxCSS = exports.readableExtensions = exports.readOnlyNoCursorExtensions = exports.readOnlyExtensions = exports.lineWrappingExtensions = exports.isAtStartOfLine = exports.historyExtensions = exports.getTooltipAbsoluteExtensions = exports.getThemeExtensions = exports.getTabKeyExtensions = 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.tabKeyExtensions = exports.syntaxCSS = exports.readableExtensions = exports.readOnlyNoCursorExtensions = exports.readOnlyExtensions = exports.lineWrappingExtensions = exports.historyExtensions = exports.getTooltipAbsoluteExtensions = exports.getThemeExtensions = exports.getTabKeyExtensions = exports.getSearchExtensions = 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; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
@@ -232,37 +232,32 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
})]; | ||
const historyExtensions = [(0, _commands.history)()]; | ||
exports.historyExtensions = historyExtensions; | ||
const whitespaceRegex = /[\s]/; | ||
const isAtStartOfLine = state => { | ||
const positionObject = (0, _cypherStateSelectors.getStatePositionAnchor)(state); | ||
const value = (0, _cypherStateSelectors.getStateValue)(state); | ||
const lineStart = positionObject.position - positionObject.column; | ||
for (let i = 0; i < positionObject.column; i++) { | ||
if (!whitespaceRegex.test(value.charAt(lineStart + i))) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
exports.isAtStartOfLine = isAtStartOfLine; | ||
const runTab = (view, event) => { | ||
const status = (0, _autocomplete.completionStatus)(view.state); | ||
const runTab = view => { | ||
const { | ||
state, | ||
dispatch | ||
} = view; | ||
const status = (0, _autocomplete.completionStatus)(state); | ||
if (status === null) { | ||
if (isAtStartOfLine(view.state)) { | ||
(0, _commands.indentMore)(view); | ||
if ((0, _cypherStateSelectors.getStateHasSelection)(state)) { | ||
return (0, _commands.indentMore)(view); | ||
} else { | ||
(0, _commands.insertTab)(view); | ||
dispatch(state.update(state.replaceSelection(state.facet(_language.indentUnit)), { | ||
scrollIntoView: true, | ||
userEvent: "input" | ||
})); | ||
return true; | ||
} | ||
event && event.preventDefault(); | ||
} else if (status === "active") { | ||
(0, _autocomplete.acceptCompletion)(view); | ||
event && event.preventDefault(); | ||
return (0, _autocomplete.acceptCompletion)(view); | ||
} | ||
return false; | ||
}; | ||
const shiftTab = (view, event) => { | ||
const status = (0, _autocomplete.completionStatus)(view.state); | ||
if (status === null && isAtStartOfLine(view.state)) { | ||
(0, _commands.indentLess)(view); | ||
event && event.preventDefault(); | ||
const shiftTab = view => { | ||
const { | ||
state | ||
} = view; | ||
const status = (0, _autocomplete.completionStatus)(state); | ||
if (status === null && (0, _cypherStateSelectors.getStateHasSelection)(state)) { | ||
return (0, _commands.indentLess)(view); | ||
} | ||
return false; | ||
}; | ||
@@ -275,3 +270,11 @@ const tabKeyExtensions = [_view.keymap.of([{ | ||
exports.tabKeyExtensions = tabKeyExtensions; | ||
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])]; | ||
const historyExtensions = [(0, _commands.history)(), _view.keymap.of(_commands.historyKeymap)]; | ||
exports.historyExtensions = historyExtensions; | ||
const searchTopExtensions = [(0, _search.search)({ | ||
top: true | ||
}), _view.keymap.of(_search.searchKeymap)]; | ||
const searchBottomExtensions = [(0, _search.search)({ | ||
top: false | ||
}), _view.keymap.of(_search.searchKeymap)]; | ||
const readableExtensions = [(0, _view.drawSelection)(), _state.EditorState.allowMultipleSelections.of(true), (0, _language.indentOnInput)(), (0, _view.rectangularSelection)(), (0, _view.crosshairCursor)(), _view.keymap.of([..._commands.defaultKeymap, ..._language.foldKeymap])]; | ||
exports.readableExtensions = readableExtensions; | ||
@@ -284,3 +287,3 @@ const readOnlyExtensions = [_state.EditorState.readOnly.of(true)]; | ||
exports.lineWrappingExtensions = lineWrappingExtensions; | ||
const useLintExtensions = [cypherLinter()]; | ||
const useLintExtensions = [cypherLinter(), _view.keymap.of(_lint.lintKeymap)]; | ||
exports.useLintExtensions = useLintExtensions; | ||
@@ -291,7 +294,7 @@ const useNoLintExtensions = [cypherLinter({ | ||
exports.useNoLintExtensions = useNoLintExtensions; | ||
const useAutocompleteExtensions = [cypherCompletion()]; | ||
const useAutocompleteExtensions = [cypherCompletion(), _view.keymap.of(_autocomplete.completionKeymap)]; | ||
exports.useAutocompleteExtensions = useAutocompleteExtensions; | ||
const useStickyAutocompleteExtensions = [cypherCompletion({ | ||
closeOnBlur: false | ||
})]; | ||
}), _view.keymap.of(_autocomplete.completionKeymap)]; | ||
@@ -343,4 +346,5 @@ // GETTERS | ||
const getTabKeyExtensions = ({ | ||
tabKey | ||
}) => tabKey ? tabKeyExtensions : []; | ||
tabKey, | ||
indentUnit | ||
}) => tabKey ? tabKeyExtensions.concat(_language.indentUnit.of(indentUnit)) : []; | ||
exports.getTabKeyExtensions = getTabKeyExtensions; | ||
@@ -351,2 +355,8 @@ const getThemeExtensions = ({ | ||
exports.getThemeExtensions = getThemeExtensions; | ||
const getSearchExtensions = ({ | ||
readOnly, | ||
search, | ||
searchTop | ||
}) => search ? searchTop ? searchTopExtensions : searchBottomExtensions : []; | ||
exports.getSearchExtensions = getSearchExtensions; | ||
const getTooltipAbsoluteExtensions = ({ | ||
@@ -353,0 +363,0 @@ tooltipAbsolute |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.getStateValue = exports.getStatePositionForAny = exports.getStatePositionForAbsolute = exports.getStatePositionAnchorAbsolute = exports.getStatePositionAnchor = exports.getStatePositionAbsoluteForLineColumn = exports.getStatePositionAbsolute = exports.getStatePosition = exports.getStateLineObjectForLine = exports.getStateLineObjectForAbsolute = exports.getStateLineCount = exports.getStateLength = exports.getStateEditorSupport = void 0; | ||
exports.getStateValue = exports.getStatePositionForAny = exports.getStatePositionForAbsolute = exports.getStatePositionAnchorAbsolute = exports.getStatePositionAnchor = exports.getStatePositionAbsoluteForLineColumn = exports.getStatePositionAbsolute = exports.getStatePosition = exports.getStateLineObjectForLine = exports.getStateLineObjectForAbsolute = exports.getStateLineCount = exports.getStateLength = exports.getStateHasSelection = exports.getStateEditorSupport = void 0; | ||
var _cypherCodemirrorBase = require("./cypher-codemirror-base"); | ||
@@ -121,2 +121,4 @@ var _cypherStateDefinitions = require("./cypher-state-definitions"); | ||
}; | ||
exports.getStatePositionForAny = getStatePositionForAny; | ||
exports.getStatePositionForAny = getStatePositionForAny; | ||
const getStateHasSelection = state => state.selection.ranges.some(r => !r.empty); | ||
exports.getStateHasSelection = getStateHasSelection; |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.0.0-next.10", | ||
"version": "1.0.0-next.11", | ||
"author": "Neo4j Inc.", | ||
@@ -12,0 +12,0 @@ "license": "GPL-3.0", |
@@ -269,2 +269,6 @@ /** | ||
/** | ||
* Set the indent text to use when tabKey is enabled | ||
*/ | ||
setIndentUnit(indentUnit?: string): void; | ||
/** | ||
* Set the formatter for the line numbers of the editor | ||
@@ -308,2 +312,10 @@ */ | ||
/** | ||
* Set whether search is enabled | ||
*/ | ||
setSearch(search?: boolean): void; | ||
/** | ||
* Set whether search is appears at the top of the editor window | ||
*/ | ||
setSearchTop(searchTop?: boolean): void; | ||
/** | ||
* Set whether the tab key is enabled | ||
@@ -460,2 +472,8 @@ */ | ||
/** | ||
* The indent text to use when tabKey is enabled | ||
* | ||
* @defaultValue " " | ||
*/ | ||
indentUnit?: string; | ||
/** | ||
* The formatter for the line numbers of the editor | ||
@@ -521,2 +539,14 @@ * | ||
/** | ||
* Whether search is enabled | ||
* | ||
* @defaultValue true | ||
*/ | ||
search?: boolean; | ||
/** | ||
* Whether search is shown at the top of the editor window | ||
* | ||
* @defaultValue false | ||
*/ | ||
searchTop?: boolean; | ||
/** | ||
* Whether the tab key is enabled | ||
@@ -523,0 +553,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
151945
3816