@atlaskit/editor-core 189.3.3 → 189.3.6
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.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/presets/default.js +2 -2
- package/dist/cjs/utils/deprecation-warnings.js +1 -3
- package/dist/cjs/utils/editorDeprecationWarnings.js +2 -4
- package/dist/cjs/version-wrapper.js +2 -5
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/presets/default.js +1 -1
- package/dist/es2019/utils/deprecation-warnings.js +1 -3
- package/dist/es2019/utils/editorDeprecationWarnings.js +2 -4
- package/dist/es2019/version-wrapper.js +1 -4
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/presets/default.js +1 -1
- package/dist/esm/utils/deprecation-warnings.js +1 -3
- package/dist/esm/utils/editorDeprecationWarnings.js +2 -4
- package/dist/esm/version-wrapper.js +1 -4
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +1 -1
- package/dist/types/presets/default.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/version-wrapper.d.ts +0 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
- package/dist/types-ts4.5/presets/default.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/version-wrapper.d.ts +0 -1
- package/package.json +4 -3
- package/report.api.md +1 -11
- package/tmp/api-report-tmp.d.ts +1 -11
- package/dist/cjs/plugins/code-block/actions.js +0 -201
- package/dist/cjs/plugins/code-block/ide-ux/bracket-handling.js +0 -35
- package/dist/cjs/plugins/code-block/ide-ux/commands.js +0 -115
- package/dist/cjs/plugins/code-block/ide-ux/line-handling.js +0 -81
- package/dist/cjs/plugins/code-block/ide-ux/paired-character-handling.js +0 -23
- package/dist/cjs/plugins/code-block/ide-ux/quote-handling.js +0 -40
- package/dist/cjs/plugins/code-block/index.js +0 -120
- package/dist/cjs/plugins/code-block/language-list.js +0 -62
- package/dist/cjs/plugins/code-block/nodeviews/code-block.js +0 -153
- package/dist/cjs/plugins/code-block/plugin-key.js +0 -8
- package/dist/cjs/plugins/code-block/pm-plugins/actions.js +0 -10
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +0 -113
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +0 -132
- package/dist/cjs/plugins/code-block/pm-plugins/input-rule.js +0 -68
- package/dist/cjs/plugins/code-block/pm-plugins/keymaps.js +0 -66
- package/dist/cjs/plugins/code-block/pm-plugins/main-state.js +0 -10
- package/dist/cjs/plugins/code-block/pm-plugins/main.js +0 -114
- package/dist/cjs/plugins/code-block/refresh-browser-selection.js +0 -29
- package/dist/cjs/plugins/code-block/toolbar.js +0 -131
- package/dist/cjs/plugins/code-block/transform-to-code-block.js +0 -84
- package/dist/cjs/plugins/code-block/types.js +0 -5
- package/dist/cjs/plugins/code-block/ui/class-names.js +0 -15
- package/dist/cjs/plugins/code-block/utils.js +0 -28
- package/dist/es2019/plugins/code-block/actions.js +0 -211
- package/dist/es2019/plugins/code-block/ide-ux/bracket-handling.js +0 -27
- package/dist/es2019/plugins/code-block/ide-ux/commands.js +0 -114
- package/dist/es2019/plugins/code-block/ide-ux/line-handling.js +0 -75
- package/dist/es2019/plugins/code-block/ide-ux/paired-character-handling.js +0 -12
- package/dist/es2019/plugins/code-block/ide-ux/quote-handling.js +0 -32
- package/dist/es2019/plugins/code-block/index.js +0 -104
- package/dist/es2019/plugins/code-block/language-list.js +0 -51
- package/dist/es2019/plugins/code-block/nodeviews/code-block.js +0 -126
- package/dist/es2019/plugins/code-block/plugin-key.js +0 -2
- package/dist/es2019/plugins/code-block/pm-plugins/actions.js +0 -4
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +0 -101
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +0 -135
- package/dist/es2019/plugins/code-block/pm-plugins/input-rule.js +0 -60
- package/dist/es2019/plugins/code-block/pm-plugins/keymaps.js +0 -58
- package/dist/es2019/plugins/code-block/pm-plugins/main-state.js +0 -2
- package/dist/es2019/plugins/code-block/pm-plugins/main.js +0 -102
- package/dist/es2019/plugins/code-block/refresh-browser-selection.js +0 -25
- package/dist/es2019/plugins/code-block/toolbar.js +0 -108
- package/dist/es2019/plugins/code-block/transform-to-code-block.js +0 -79
- package/dist/es2019/plugins/code-block/types.js +0 -1
- package/dist/es2019/plugins/code-block/ui/class-names.js +0 -9
- package/dist/es2019/plugins/code-block/utils.js +0 -4
- package/dist/esm/plugins/code-block/actions.js +0 -191
- package/dist/esm/plugins/code-block/ide-ux/bracket-handling.js +0 -29
- package/dist/esm/plugins/code-block/ide-ux/commands.js +0 -106
- package/dist/esm/plugins/code-block/ide-ux/line-handling.js +0 -73
- package/dist/esm/plugins/code-block/ide-ux/paired-character-handling.js +0 -16
- package/dist/esm/plugins/code-block/ide-ux/quote-handling.js +0 -34
- package/dist/esm/plugins/code-block/index.js +0 -113
- package/dist/esm/plugins/code-block/language-list.js +0 -52
- package/dist/esm/plugins/code-block/nodeviews/code-block.js +0 -146
- package/dist/esm/plugins/code-block/plugin-key.js +0 -2
- package/dist/esm/plugins/code-block/pm-plugins/actions.js +0 -4
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +0 -103
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +0 -126
- package/dist/esm/plugins/code-block/pm-plugins/input-rule.js +0 -62
- package/dist/esm/plugins/code-block/pm-plugins/keymaps.js +0 -59
- package/dist/esm/plugins/code-block/pm-plugins/main-state.js +0 -4
- package/dist/esm/plugins/code-block/pm-plugins/main.js +0 -107
- package/dist/esm/plugins/code-block/refresh-browser-selection.js +0 -25
- package/dist/esm/plugins/code-block/toolbar.js +0 -121
- package/dist/esm/plugins/code-block/transform-to-code-block.js +0 -77
- package/dist/esm/plugins/code-block/types.js +0 -1
- package/dist/esm/plugins/code-block/ui/class-names.js +0 -9
- package/dist/esm/plugins/code-block/utils.js +0 -4
- package/dist/types/plugins/code-block/actions.d.ts +0 -18
- package/dist/types/plugins/code-block/ide-ux/bracket-handling.d.ts +0 -12
- package/dist/types/plugins/code-block/ide-ux/commands.d.ts +0 -7
- package/dist/types/plugins/code-block/ide-ux/line-handling.d.ts +0 -25
- package/dist/types/plugins/code-block/ide-ux/paired-character-handling.d.ts +0 -2
- package/dist/types/plugins/code-block/ide-ux/quote-handling.d.ts +0 -12
- package/dist/types/plugins/code-block/index.d.ts +0 -19
- package/dist/types/plugins/code-block/language-list.d.ts +0 -942
- package/dist/types/plugins/code-block/nodeviews/code-block.d.ts +0 -21
- package/dist/types/plugins/code-block/plugin-key.d.ts +0 -2
- package/dist/types/plugins/code-block/pm-plugins/actions.d.ts +0 -4
- package/dist/types/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +0 -11
- package/dist/types/plugins/code-block/pm-plugins/ide-ux.d.ts +0 -5
- package/dist/types/plugins/code-block/pm-plugins/input-rule.d.ts +0 -3
- package/dist/types/plugins/code-block/pm-plugins/keymaps.d.ts +0 -4
- package/dist/types/plugins/code-block/pm-plugins/main-state.d.ts +0 -8
- package/dist/types/plugins/code-block/pm-plugins/main.d.ts +0 -10
- package/dist/types/plugins/code-block/refresh-browser-selection.d.ts +0 -5
- package/dist/types/plugins/code-block/toolbar.d.ts +0 -14
- package/dist/types/plugins/code-block/transform-to-code-block.d.ts +0 -3
- package/dist/types/plugins/code-block/types.d.ts +0 -6
- package/dist/types/plugins/code-block/ui/class-names.d.ts +0 -8
- package/dist/types/plugins/code-block/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/code-block/actions.d.ts +0 -18
- package/dist/types-ts4.5/plugins/code-block/ide-ux/bracket-handling.d.ts +0 -12
- package/dist/types-ts4.5/plugins/code-block/ide-ux/commands.d.ts +0 -7
- package/dist/types-ts4.5/plugins/code-block/ide-ux/line-handling.d.ts +0 -25
- package/dist/types-ts4.5/plugins/code-block/ide-ux/paired-character-handling.d.ts +0 -2
- package/dist/types-ts4.5/plugins/code-block/ide-ux/quote-handling.d.ts +0 -12
- package/dist/types-ts4.5/plugins/code-block/index.d.ts +0 -19
- package/dist/types-ts4.5/plugins/code-block/language-list.d.ts +0 -1641
- package/dist/types-ts4.5/plugins/code-block/nodeviews/code-block.d.ts +0 -21
- package/dist/types-ts4.5/plugins/code-block/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/actions.d.ts +0 -4
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.d.ts +0 -14
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/ide-ux.d.ts +0 -5
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/input-rule.d.ts +0 -3
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/keymaps.d.ts +0 -4
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/main-state.d.ts +0 -8
- package/dist/types-ts4.5/plugins/code-block/pm-plugins/main.d.ts +0 -10
- package/dist/types-ts4.5/plugins/code-block/refresh-browser-selection.d.ts +0 -5
- package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +0 -14
- package/dist/types-ts4.5/plugins/code-block/transform-to-code-block.d.ts +0 -3
- package/dist/types-ts4.5/plugins/code-block/types.d.ts +0 -6
- package/dist/types-ts4.5/plugins/code-block/ui/class-names.d.ts +0 -8
- package/dist/types-ts4.5/plugins/code-block/utils.d.ts +0 -4
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createCodeBlockInputRule = createCodeBlockInputRule;
|
|
7
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
-
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
9
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
11
|
-
var _transformToCodeBlock = require("../transform-to-code-block");
|
|
12
|
-
var _commands = require("@atlaskit/editor-common/commands");
|
|
13
|
-
function createCodeBlockInputRule(schema, editorAnalyticsAPI) {
|
|
14
|
-
var rules = getCodeBlockRules(editorAnalyticsAPI, schema);
|
|
15
|
-
return (0, _prosemirrorInputRules.createPlugin)('code-block-input-rule', rules, {
|
|
16
|
-
isBlockNodeRule: true
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get all code block input rules
|
|
22
|
-
*
|
|
23
|
-
* @param {Schema} schema
|
|
24
|
-
* @returns {InputRuleWithHandler[]}
|
|
25
|
-
*/
|
|
26
|
-
function getCodeBlockRules(editorAnalyticsAPI, schema) {
|
|
27
|
-
var ruleAnalytics = (0, _utils2.inputRuleWithAnalytics)({
|
|
28
|
-
action: _analytics.ACTION.INSERTED,
|
|
29
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
30
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.CODE_BLOCK,
|
|
31
|
-
attributes: {
|
|
32
|
-
inputMethod: _analytics.INPUT_METHOD.FORMATTING
|
|
33
|
-
},
|
|
34
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
35
|
-
}, editorAnalyticsAPI);
|
|
36
|
-
var validMatchLength = function validMatchLength(match) {
|
|
37
|
-
return match.length > 0 && match[0].length === 3;
|
|
38
|
-
};
|
|
39
|
-
var threeTildeRule = (0, _prosemirrorInputRules.createRule)(/(?!\s)(`{3,})$/, function (state, match, start, end) {
|
|
40
|
-
if (!validMatchLength(match)) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
var attributes = {};
|
|
44
|
-
if (match[4]) {
|
|
45
|
-
attributes.language = match[4];
|
|
46
|
-
}
|
|
47
|
-
if ((0, _transformToCodeBlock.isConvertableToCodeBlock)(state)) {
|
|
48
|
-
return (0, _transformToCodeBlock.transformToCodeBlockAction)(state, start, attributes);
|
|
49
|
-
}
|
|
50
|
-
var tr = state.tr;
|
|
51
|
-
tr.delete(start, end);
|
|
52
|
-
var codeBlock = tr.doc.type.schema.nodes.codeBlock.createChecked();
|
|
53
|
-
(0, _utils.safeInsert)(codeBlock)(tr);
|
|
54
|
-
return tr;
|
|
55
|
-
});
|
|
56
|
-
var leftNodeReplacementThreeTildeRule = (0, _prosemirrorInputRules.createRule)(new RegExp("((".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "`{3,})|^\\s(`{3,}))(\\S*)$")), function (state, match, start, end) {
|
|
57
|
-
if (!validMatchLength(match)) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
var attributes = {};
|
|
61
|
-
if (match[4]) {
|
|
62
|
-
attributes.language = match[4];
|
|
63
|
-
}
|
|
64
|
-
var inlineStart = Math.max(match.index + state.selection.$from.start(), 1);
|
|
65
|
-
return (0, _commands.insertBlock)(state, schema.nodes.codeBlock, inlineStart, end, attributes);
|
|
66
|
-
});
|
|
67
|
-
return [ruleAnalytics(threeTildeRule), ruleAnalytics(leftNodeReplacementThreeTildeRule)];
|
|
68
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
exports.keymapPlugin = keymapPlugin;
|
|
8
|
-
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
9
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var _utils2 = require("../utils");
|
|
12
|
-
var _utils3 = require("@atlaskit/editor-common/utils");
|
|
13
|
-
var deleteCurrentItem = function deleteCurrentItem($from) {
|
|
14
|
-
return function (tr) {
|
|
15
|
-
return tr.delete($from.before($from.depth), $from.after($from.depth));
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
var setTextSelection = function setTextSelection(pos) {
|
|
19
|
-
return function (tr) {
|
|
20
|
-
var newSelection = _state.Selection.findFrom(tr.doc.resolve(pos), -1, true);
|
|
21
|
-
if (newSelection) {
|
|
22
|
-
tr.setSelection(newSelection);
|
|
23
|
-
}
|
|
24
|
-
return tr;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
function keymapPlugin(schema) {
|
|
28
|
-
return (0, _keymap.keymap)({
|
|
29
|
-
Backspace: function Backspace(state, dispatch) {
|
|
30
|
-
var $cursor = (0, _utils2.getCursor)(state.selection);
|
|
31
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
32
|
-
paragraph = _state$schema$nodes.paragraph,
|
|
33
|
-
codeBlock = _state$schema$nodes.codeBlock,
|
|
34
|
-
listItem = _state$schema$nodes.listItem,
|
|
35
|
-
table = _state$schema$nodes.table,
|
|
36
|
-
layoutColumn = _state$schema$nodes.layoutColumn;
|
|
37
|
-
if (!$cursor || $cursor.parent.type !== codeBlock || !dispatch) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
if ($cursor.pos === 1 || (0, _utils.hasParentNodeOfType)(listItem)(state.selection) && $cursor.parentOffset === 0) {
|
|
41
|
-
var node = (0, _utils.findParentNodeOfTypeClosestToPos)($cursor, codeBlock);
|
|
42
|
-
if (!node) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
dispatch(state.tr.setNodeMarkup(node.pos, node.node.type, node.node.attrs, []).setBlockType($cursor.pos, $cursor.pos, paragraph));
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
if ($cursor.node && (0, _utils3.isEmptyNode)(schema)($cursor.node()) && ((0, _utils.hasParentNodeOfType)(layoutColumn)(state.selection) || (0, _utils.hasParentNodeOfType)(table)(state.selection))) {
|
|
49
|
-
var tr = state.tr;
|
|
50
|
-
var insertPos = $cursor.pos;
|
|
51
|
-
deleteCurrentItem($cursor)(tr);
|
|
52
|
-
setTextSelection(insertPos)(tr);
|
|
53
|
-
dispatch(tr.scrollIntoView());
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Handle not nested empty code block
|
|
58
|
-
if ((0, _utils3.isEmptyNode)(schema)($cursor.node())) {
|
|
59
|
-
dispatch(deleteCurrentItem($cursor)(state === null || state === void 0 ? void 0 : state.tr));
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
var _default = exports.default = keymapPlugin;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getPluginState = void 0;
|
|
7
|
-
var _pluginKey = require("../plugin-key");
|
|
8
|
-
var getPluginState = exports.getPluginState = function getPluginState(state) {
|
|
9
|
-
return _pluginKey.pluginKey.getState(state);
|
|
10
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createPlugin = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
|
-
var _codeBlock = require("../nodeviews/code-block");
|
|
13
|
-
var _selection = require("@atlaskit/editor-common/selection");
|
|
14
|
-
var _pluginKey = require("../plugin-key");
|
|
15
|
-
var _actions = require("./actions");
|
|
16
|
-
var _actions2 = require("../actions");
|
|
17
|
-
var _utils2 = require("../utils");
|
|
18
|
-
var _classNames = require("../ui/class-names");
|
|
19
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
-
var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
22
|
-
var _ref$useLongPressSele = _ref.useLongPressSelection,
|
|
23
|
-
useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
|
|
24
|
-
getIntl = _ref.getIntl,
|
|
25
|
-
appearance = _ref.appearance,
|
|
26
|
-
_ref$allowComposition = _ref.allowCompositionInputOverride,
|
|
27
|
-
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition;
|
|
28
|
-
var handleDOMEvents = {};
|
|
29
|
-
|
|
30
|
-
// ME-1599: Composition on mobile was causing the DOM observer to mutate the code block
|
|
31
|
-
// incorrecly and lose content when pressing enter in the middle of a code block line.
|
|
32
|
-
if (allowCompositionInputOverride) {
|
|
33
|
-
handleDOMEvents.beforeinput = function (view, event) {
|
|
34
|
-
var keyEvent = event;
|
|
35
|
-
var eventInputType = keyEvent.inputType;
|
|
36
|
-
var eventText = keyEvent.data;
|
|
37
|
-
if (_utils.browser.ios && event.composed &&
|
|
38
|
-
// insertParagraph will be the input type when the enter key is pressed.
|
|
39
|
-
eventInputType === 'insertParagraph' && (0, _utils2.findCodeBlock)(view.state, view.state.selection)) {
|
|
40
|
-
event.preventDefault();
|
|
41
|
-
return true;
|
|
42
|
-
} else if (_utils.browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0, _utils2.findCodeBlock)(view.state, view.state.selection)) {
|
|
43
|
-
var resultingText = event.target.outerText + '\n';
|
|
44
|
-
if (resultingText.endsWith(eventText)) {
|
|
45
|
-
// End of paragraph
|
|
46
|
-
setTimeout(function () {
|
|
47
|
-
view.someProp('handleKeyDown', function (f) {
|
|
48
|
-
return f(view, new KeyboardEvent('keydown', {
|
|
49
|
-
bubbles: true,
|
|
50
|
-
cancelable: true,
|
|
51
|
-
key: 'Enter',
|
|
52
|
-
code: 'Enter'
|
|
53
|
-
}));
|
|
54
|
-
});
|
|
55
|
-
}, 0);
|
|
56
|
-
} else {
|
|
57
|
-
// Middle of paragraph, end of line
|
|
58
|
-
(0, _actions2.ignoreFollowingMutations)(view.state, view.dispatch);
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
if (_utils.browser.android) {
|
|
63
|
-
(0, _actions2.resetShouldIgnoreFollowingMutations)(view.state, view.dispatch);
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return new _safePlugin.SafePlugin({
|
|
69
|
-
state: {
|
|
70
|
-
init: function init(_, state) {
|
|
71
|
-
var node = (0, _utils2.findCodeBlock)(state, state.selection);
|
|
72
|
-
return {
|
|
73
|
-
pos: node ? node.pos : null,
|
|
74
|
-
contentCopied: false,
|
|
75
|
-
isNodeSelected: false,
|
|
76
|
-
shouldIgnoreFollowingMutations: false
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
80
|
-
if (tr.docChanged || tr.selectionSet) {
|
|
81
|
-
var node = (0, _utils2.findCodeBlock)(newState, tr.selection);
|
|
82
|
-
var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
83
|
-
pos: node ? node.pos : null,
|
|
84
|
-
isNodeSelected: tr.selection instanceof _state.NodeSelection
|
|
85
|
-
});
|
|
86
|
-
return newPluginState;
|
|
87
|
-
}
|
|
88
|
-
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
89
|
-
if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_COPIED_TO_CLIPBOARD) {
|
|
90
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
91
|
-
contentCopied: meta.data
|
|
92
|
-
});
|
|
93
|
-
} else if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_SHOULD_IGNORE_FOLLOWING_MUTATIONS) {
|
|
94
|
-
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
95
|
-
shouldIgnoreFollowingMutations: meta.data
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return pluginState;
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
key: _pluginKey.pluginKey,
|
|
102
|
-
props: {
|
|
103
|
-
nodeViews: {
|
|
104
|
-
codeBlock: _codeBlock.codeBlockNodeView
|
|
105
|
-
},
|
|
106
|
-
handleClickOn: (0, _selection.createSelectionClickHandler)(['codeBlock'], function (target) {
|
|
107
|
-
return !!(target.closest(".".concat(_classNames.codeBlockClassNames.gutter)) || target.classList.contains(_classNames.codeBlockClassNames.content));
|
|
108
|
-
}, {
|
|
109
|
-
useLongPressSelection: useLongPressSelection
|
|
110
|
-
}),
|
|
111
|
-
handleDOMEvents: handleDOMEvents
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.refreshBrowserSelection = exports.default = void 0;
|
|
7
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
|
-
var _pluginKey = require("./plugin-key");
|
|
9
|
-
// Workaround for a firefox issue where dom selection is off sync
|
|
10
|
-
// https://product-fabric.atlassian.net/browse/ED-12442
|
|
11
|
-
var refreshBrowserSelection = exports.refreshBrowserSelection = function refreshBrowserSelection() {
|
|
12
|
-
var domSelection = window.getSelection();
|
|
13
|
-
if (domSelection) {
|
|
14
|
-
var domRange = domSelection && domSelection.rangeCount === 1 && domSelection.getRangeAt(0).cloneRange();
|
|
15
|
-
if (domRange) {
|
|
16
|
-
domSelection.removeAllRanges();
|
|
17
|
-
domSelection.addRange(domRange);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var refreshBrowserSelectionOnChange = function refreshBrowserSelectionOnChange(transaction, editorState) {
|
|
22
|
-
var _pluginKey$getState;
|
|
23
|
-
if (_utils.browser.gecko && transaction.docChanged &&
|
|
24
|
-
// codeblockState.pos should be set if current selection is in a codeblock.
|
|
25
|
-
typeof ((_pluginKey$getState = _pluginKey.pluginKey.getState(editorState)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pos) === 'number') {
|
|
26
|
-
refreshBrowserSelection();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var _default = exports.default = refreshBrowserSelectionOnChange;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.messages = exports.languageListFilter = exports.getToolbarConfig = void 0;
|
|
9
|
-
var _reactIntlNext = require("react-intl-next");
|
|
10
|
-
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
11
|
-
var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
|
|
12
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
13
|
-
var _actions = require("./actions");
|
|
14
|
-
var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
|
|
15
|
-
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
16
|
-
var _pluginKey = require("./plugin-key");
|
|
17
|
-
var _languageList = require("./language-list");
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
-
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
21
|
-
selectLanguage: {
|
|
22
|
-
id: 'fabric.editor.selectLanguage',
|
|
23
|
-
defaultMessage: 'Select language',
|
|
24
|
-
description: 'Code blocks display software code. A prompt to select the software language the code is written in.'
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
var languageList = (0, _languageList.createLanguageList)(_languageList.DEFAULT_LANGUAGES);
|
|
28
|
-
var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
29
|
-
var allowCopyToClipboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
30
|
-
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
31
|
-
return function (state, _ref) {
|
|
32
|
-
var _api$decorations$acti, _api$analytics, _codeBlockState$pos, _node$attrs;
|
|
33
|
-
var formatMessage = _ref.formatMessage;
|
|
34
|
-
var _ref2 = (_api$decorations$acti = api === null || api === void 0 ? void 0 : api.decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
|
|
35
|
-
hoverDecoration = _ref2.hoverDecoration;
|
|
36
|
-
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
37
|
-
var codeBlockState = _pluginKey.pluginKey.getState(state);
|
|
38
|
-
var pos = (_codeBlockState$pos = codeBlockState === null || codeBlockState === void 0 ? void 0 : codeBlockState.pos) !== null && _codeBlockState$pos !== void 0 ? _codeBlockState$pos : null;
|
|
39
|
-
if (!codeBlockState || pos === null) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
var node = state.doc.nodeAt(pos);
|
|
43
|
-
var nodeType = state.schema.nodes.codeBlock;
|
|
44
|
-
if ((node === null || node === void 0 ? void 0 : node.type) !== nodeType) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
var language = node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.language;
|
|
48
|
-
var options = languageList.map(function (lang) {
|
|
49
|
-
return {
|
|
50
|
-
label: lang.name,
|
|
51
|
-
value: (0, _languageList.getLanguageIdentifier)(lang),
|
|
52
|
-
alias: lang.alias
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// If language is not undefined search for it in the value and then search in the aliases
|
|
57
|
-
var defaultValue = language ? options.find(function (option) {
|
|
58
|
-
return option.value === language;
|
|
59
|
-
}) || options.find(function (option) {
|
|
60
|
-
return option.alias.includes(language);
|
|
61
|
-
}) : null;
|
|
62
|
-
var languageSelect = {
|
|
63
|
-
id: 'editor.codeBlock.languageOptions',
|
|
64
|
-
type: 'select',
|
|
65
|
-
selectType: 'list',
|
|
66
|
-
onChange: function onChange(option) {
|
|
67
|
-
return (0, _actions.changeLanguage)(editorAnalyticsAPI)(option.value);
|
|
68
|
-
},
|
|
69
|
-
defaultValue: defaultValue,
|
|
70
|
-
placeholder: formatMessage(messages.selectLanguage),
|
|
71
|
-
options: options,
|
|
72
|
-
filterOption: languageListFilter
|
|
73
|
-
};
|
|
74
|
-
var separator = {
|
|
75
|
-
type: 'separator'
|
|
76
|
-
};
|
|
77
|
-
var copyToClipboardItems = !allowCopyToClipboard ? [] : [{
|
|
78
|
-
id: 'editor.codeBlock.copy',
|
|
79
|
-
type: 'button',
|
|
80
|
-
appearance: 'subtle',
|
|
81
|
-
icon: _copy.default,
|
|
82
|
-
// note: copyContentToClipboard contains logic that also removes the
|
|
83
|
-
// visual feedback for the copy button
|
|
84
|
-
onClick: _actions.copyContentToClipboard,
|
|
85
|
-
title: formatMessage(codeBlockState.contentCopied ? _messages.codeBlockButtonMessages.copiedCodeToClipboard : _messages.codeBlockButtonMessages.copyCodeToClipboard),
|
|
86
|
-
onMouseEnter: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
87
|
-
// note: resetCopiedState contains logic that also removes the
|
|
88
|
-
// visual feedback for the copy button
|
|
89
|
-
onMouseLeave: _actions.resetCopiedState,
|
|
90
|
-
onFocus: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
91
|
-
onBlur: _codeBlockCopySelectionPlugin.removeVisualFeedbackForCopyButton,
|
|
92
|
-
hideTooltipOnClick: false,
|
|
93
|
-
disabled: codeBlockState.isNodeSelected,
|
|
94
|
-
tabIndex: null
|
|
95
|
-
}, separator];
|
|
96
|
-
var deleteButton = {
|
|
97
|
-
id: 'editor.codeBlock.delete',
|
|
98
|
-
type: 'button',
|
|
99
|
-
appearance: 'danger',
|
|
100
|
-
icon: _remove.default,
|
|
101
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
102
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
103
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
104
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
105
|
-
onClick: _actions.removeCodeBlock,
|
|
106
|
-
title: formatMessage(_messages.default.remove),
|
|
107
|
-
tabIndex: null
|
|
108
|
-
};
|
|
109
|
-
return {
|
|
110
|
-
title: 'CodeBlock floating controls',
|
|
111
|
-
getDomRef: function getDomRef(view) {
|
|
112
|
-
return (0, _utils.findDomRefAtPos)(pos, view.domAtPos.bind(view));
|
|
113
|
-
},
|
|
114
|
-
nodeType: nodeType,
|
|
115
|
-
items: [languageSelect, separator].concat(copyToClipboardItems, [deleteButton]),
|
|
116
|
-
scrollable: true
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Filters language list based on both name and alias properties.
|
|
123
|
-
*/
|
|
124
|
-
var languageListFilter = exports.languageListFilter = function languageListFilter(option, rawInput) {
|
|
125
|
-
var _ref3 = option,
|
|
126
|
-
data = _ref3.data;
|
|
127
|
-
var searchString = rawInput.toLowerCase();
|
|
128
|
-
return data.label.toLowerCase().includes(searchString) || data.alias.some(function (alias) {
|
|
129
|
-
return alias.toLowerCase() === searchString;
|
|
130
|
-
});
|
|
131
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isConvertableToCodeBlock = isConvertableToCodeBlock;
|
|
7
|
-
exports.transformToCodeBlockAction = transformToCodeBlockAction;
|
|
8
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
-
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
10
|
-
var _selection = require("@atlaskit/editor-common/selection");
|
|
11
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
|
-
function transformToCodeBlockAction(state, start, attrs) {
|
|
13
|
-
var startOfCodeBlockText = state.selection.$from;
|
|
14
|
-
var endPosition = state.selection.empty && !(state.selection instanceof _selection.GapCursorSelection) ? startOfCodeBlockText.end() : state.selection.$to.pos;
|
|
15
|
-
var startLinePosition = startOfCodeBlockText.start();
|
|
16
|
-
//when cmd+A is used to select the content. start position should be 0.
|
|
17
|
-
var parentStartPosition = startOfCodeBlockText.depth === 0 ? 0 : startOfCodeBlockText.before();
|
|
18
|
-
var contentSlice = state.doc.slice(startOfCodeBlockText.pos, endPosition);
|
|
19
|
-
var codeBlockSlice = (0, _utils.mapSlice)(contentSlice, function (node, parent, index) {
|
|
20
|
-
if (node.type === state.schema.nodes.hardBreak) {
|
|
21
|
-
return state.schema.text('\n');
|
|
22
|
-
}
|
|
23
|
-
if (node.isText) {
|
|
24
|
-
return node.mark([]);
|
|
25
|
-
}
|
|
26
|
-
if (node.isInline) {
|
|
27
|
-
// Convert dates
|
|
28
|
-
if (node.attrs.timestamp) {
|
|
29
|
-
return state.schema.text((0, _utils.timestampToString)(node.attrs.timestamp, null));
|
|
30
|
-
}
|
|
31
|
-
// Convert links
|
|
32
|
-
if (node.attrs.url) {
|
|
33
|
-
return state.schema.text(node.attrs.url);
|
|
34
|
-
}
|
|
35
|
-
return node.attrs.text ? state.schema.text(node.attrs.text) : null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// if the current node is the last child of the Slice exit early to prevent
|
|
39
|
-
// adding additional line breaks
|
|
40
|
-
if (contentSlice.content.childCount - 1 === index) {
|
|
41
|
-
return node.content;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//useful to decide whether to append line breaks when the content has list items.
|
|
45
|
-
var isParentLastChild = parent && contentSlice.content.childCount - 1 === index;
|
|
46
|
-
|
|
47
|
-
// add line breaks at the end of each paragraph to mimic layout of selected content
|
|
48
|
-
// do not add line breaks when the 'paragraph' parent is last child.
|
|
49
|
-
if (node.content.childCount && node.type === state.schema.nodes.paragraph && !isParentLastChild) {
|
|
50
|
-
return node.content.append(_model.Fragment.from(state.schema.text('\n\n')));
|
|
51
|
-
}
|
|
52
|
-
return node.content.childCount ? node.content : null;
|
|
53
|
-
});
|
|
54
|
-
var tr = state.tr;
|
|
55
|
-
|
|
56
|
-
// Replace current block node
|
|
57
|
-
var startMapped = startLinePosition === start ? parentStartPosition : start;
|
|
58
|
-
var codeBlock = state.schema.nodes.codeBlock;
|
|
59
|
-
var codeBlockNode = codeBlock.createChecked(attrs, codeBlockSlice.content);
|
|
60
|
-
tr.replaceWith(startMapped, Math.min(endPosition, tr.doc.content.size), codeBlockNode);
|
|
61
|
-
|
|
62
|
-
// Reposition cursor when inserting into layouts or table headers
|
|
63
|
-
var mapped = tr.doc.resolve(tr.mapping.map(startMapped) + 1);
|
|
64
|
-
var selection = _state.TextSelection.findFrom(mapped, state.selection instanceof _selection.GapCursorSelection ? -1 : 1, true);
|
|
65
|
-
if (selection) {
|
|
66
|
-
return tr.setSelection(selection);
|
|
67
|
-
}
|
|
68
|
-
return tr.setSelection(_state.TextSelection.create(tr.doc, Math.min(start + startOfCodeBlockText.node().nodeSize - 1, tr.doc.content.size)));
|
|
69
|
-
}
|
|
70
|
-
function isConvertableToCodeBlock(state) {
|
|
71
|
-
// Before a document is loaded, there is no selection.
|
|
72
|
-
if (!state.selection) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
var $from = state.selection.$from;
|
|
76
|
-
var node = $from.parent;
|
|
77
|
-
if (!node.isTextblock || node.type === state.schema.nodes.codeBlock) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
var parentDepth = $from.depth - 1;
|
|
81
|
-
var parentNode = $from.node(parentDepth);
|
|
82
|
-
var index = $from.index(parentDepth);
|
|
83
|
-
return parentNode.canReplaceWith(index, index + 1, state.schema.nodes.codeBlock);
|
|
84
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.codeBlockClassNames = void 0;
|
|
7
|
-
var _styles = require("@atlaskit/editor-common/styles");
|
|
8
|
-
var codeBlockClassNames = exports.codeBlockClassNames = {
|
|
9
|
-
container: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTAINER,
|
|
10
|
-
start: _styles.CodeBlockSharedCssClassName.CODEBLOCK_START,
|
|
11
|
-
end: _styles.CodeBlockSharedCssClassName.CODEBLOCK_END,
|
|
12
|
-
contentWrapper: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT_WRAPPER,
|
|
13
|
-
gutter: _styles.CodeBlockSharedCssClassName.CODEBLOCK_LINE_NUMBER_GUTTER,
|
|
14
|
-
content: _styles.CodeBlockSharedCssClassName.CODEBLOCK_CONTENT
|
|
15
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "findCodeBlock", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _transforms.findCodeBlock;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.getCursor = getCursor;
|
|
13
|
-
Object.defineProperty(exports, "transformSingleLineCodeBlockToCodeMark", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _transforms.transformSingleLineCodeBlockToCodeMark;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "transformSliceToJoinAdjacentCodeBlocks", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function get() {
|
|
22
|
-
return _transforms.transformSliceToJoinAdjacentCodeBlocks;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
26
|
-
function getCursor(selection) {
|
|
27
|
-
return selection.$cursor || undefined;
|
|
28
|
-
}
|