@atlaskit/editor-plugin-code-block 3.5.4 → 3.5.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/{plugin.js → codeBlockPlugin.js} +5 -5
- package/dist/cjs/{actions.js → editor-commands/index.js} +5 -5
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/nodeviews/code-block.js +2 -2
- package/dist/cjs/pm-plugins/codeBlockAutoFullStopTransformPlugin.js +1 -1
- package/dist/cjs/pm-plugins/decorators.js +1 -1
- package/dist/cjs/pm-plugins/ide-ux.js +6 -6
- package/dist/cjs/pm-plugins/input-rule.js +1 -1
- package/dist/cjs/pm-plugins/keymaps.js +1 -1
- package/dist/cjs/pm-plugins/main-state.js +1 -1
- package/dist/cjs/pm-plugins/main.js +9 -9
- package/dist/cjs/{toolbar.js → pm-plugins/toolbar.js} +8 -8
- package/dist/cjs/types/index.js +5 -0
- package/dist/es2019/{plugin.js → codeBlockPlugin.js} +3 -3
- package/dist/es2019/{actions.js → editor-commands/index.js} +5 -5
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/nodeviews/code-block.js +1 -1
- package/dist/es2019/pm-plugins/codeBlockAutoFullStopTransformPlugin.js +1 -1
- package/dist/es2019/pm-plugins/decorators.js +1 -1
- package/dist/es2019/pm-plugins/ide-ux.js +6 -6
- package/dist/es2019/pm-plugins/input-rule.js +1 -1
- package/dist/es2019/pm-plugins/keymaps.js +1 -1
- package/dist/es2019/pm-plugins/main-state.js +1 -1
- package/dist/es2019/pm-plugins/main.js +3 -3
- package/dist/es2019/{toolbar.js → pm-plugins/toolbar.js} +3 -3
- package/dist/esm/{plugin.js → codeBlockPlugin.js} +3 -3
- package/dist/esm/codeBlockPluginType.js +1 -0
- package/dist/esm/{actions.js → editor-commands/index.js} +5 -5
- package/dist/esm/index.js +1 -1
- package/dist/esm/nodeviews/code-block.js +1 -1
- package/dist/esm/pm-plugins/codeBlockAutoFullStopTransformPlugin.js +1 -1
- package/dist/esm/pm-plugins/decorators.js +1 -1
- package/dist/esm/pm-plugins/ide-ux.js +6 -6
- package/dist/esm/pm-plugins/input-rule.js +1 -1
- package/dist/esm/pm-plugins/keymaps.js +1 -1
- package/dist/esm/pm-plugins/main-state.js +1 -1
- package/dist/esm/pm-plugins/main.js +3 -3
- package/dist/esm/{toolbar.js → pm-plugins/toolbar.js} +3 -3
- package/dist/esm/types/index.js +1 -0
- package/dist/types/codeBlockPlugin.d.ts +3 -0
- package/dist/types/{plugin.d.ts → codeBlockPluginType.d.ts} +1 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/nodeviews/code-block.d.ts +1 -1
- package/dist/types/{toolbar.d.ts → pm-plugins/toolbar.d.ts} +1 -1
- package/dist/types-ts4.5/codeBlockPlugin.d.ts +3 -0
- package/dist/types-ts4.5/{plugin.d.ts → codeBlockPluginType.d.ts} +1 -3
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/code-block.d.ts +1 -1
- package/dist/types-ts4.5/{toolbar.d.ts → pm-plugins/toolbar.d.ts} +1 -1
- package/package.json +6 -3
- /package/dist/cjs/{types.js → codeBlockPluginType.js} +0 -0
- /package/dist/cjs/{ide-ux → pm-plugins/ide-ux}/bracket-handling.js +0 -0
- /package/dist/cjs/{ide-ux → pm-plugins/ide-ux}/commands.js +0 -0
- /package/dist/cjs/{ide-ux → pm-plugins/ide-ux}/line-handling.js +0 -0
- /package/dist/cjs/{ide-ux → pm-plugins/ide-ux}/paired-character-handling.js +0 -0
- /package/dist/cjs/{ide-ux → pm-plugins/ide-ux}/quote-handling.js +0 -0
- /package/dist/cjs/{language-list.js → pm-plugins/language-list.js} +0 -0
- /package/dist/cjs/{plugin-key.js → pm-plugins/plugin-key.js} +0 -0
- /package/dist/cjs/{refresh-browser-selection.js → pm-plugins/refresh-browser-selection.js} +0 -0
- /package/dist/cjs/{transform-to-code-block.js → pm-plugins/transform-to-code-block.js} +0 -0
- /package/dist/cjs/{utils.js → pm-plugins/utils.js} +0 -0
- /package/dist/es2019/{types.js → codeBlockPluginType.js} +0 -0
- /package/dist/es2019/{ide-ux → pm-plugins/ide-ux}/bracket-handling.js +0 -0
- /package/dist/es2019/{ide-ux → pm-plugins/ide-ux}/commands.js +0 -0
- /package/dist/es2019/{ide-ux → pm-plugins/ide-ux}/line-handling.js +0 -0
- /package/dist/es2019/{ide-ux → pm-plugins/ide-ux}/paired-character-handling.js +0 -0
- /package/dist/es2019/{ide-ux → pm-plugins/ide-ux}/quote-handling.js +0 -0
- /package/dist/es2019/{language-list.js → pm-plugins/language-list.js} +0 -0
- /package/dist/es2019/{plugin-key.js → pm-plugins/plugin-key.js} +0 -0
- /package/dist/es2019/{refresh-browser-selection.js → pm-plugins/refresh-browser-selection.js} +0 -0
- /package/dist/es2019/{transform-to-code-block.js → pm-plugins/transform-to-code-block.js} +0 -0
- /package/dist/es2019/{utils.js → pm-plugins/utils.js} +0 -0
- /package/dist/{esm/types.js → es2019/types/index.js} +0 -0
- /package/dist/esm/{ide-ux → pm-plugins/ide-ux}/bracket-handling.js +0 -0
- /package/dist/esm/{ide-ux → pm-plugins/ide-ux}/commands.js +0 -0
- /package/dist/esm/{ide-ux → pm-plugins/ide-ux}/line-handling.js +0 -0
- /package/dist/esm/{ide-ux → pm-plugins/ide-ux}/paired-character-handling.js +0 -0
- /package/dist/esm/{ide-ux → pm-plugins/ide-ux}/quote-handling.js +0 -0
- /package/dist/esm/{language-list.js → pm-plugins/language-list.js} +0 -0
- /package/dist/esm/{plugin-key.js → pm-plugins/plugin-key.js} +0 -0
- /package/dist/esm/{refresh-browser-selection.js → pm-plugins/refresh-browser-selection.js} +0 -0
- /package/dist/esm/{transform-to-code-block.js → pm-plugins/transform-to-code-block.js} +0 -0
- /package/dist/esm/{utils.js → pm-plugins/utils.js} +0 -0
- /package/dist/types/{actions.d.ts → editor-commands/index.d.ts} +0 -0
- /package/dist/types/{ide-ux → pm-plugins/ide-ux}/bracket-handling.d.ts +0 -0
- /package/dist/types/{ide-ux → pm-plugins/ide-ux}/commands.d.ts +0 -0
- /package/dist/types/{ide-ux → pm-plugins/ide-ux}/line-handling.d.ts +0 -0
- /package/dist/types/{ide-ux → pm-plugins/ide-ux}/paired-character-handling.d.ts +0 -0
- /package/dist/types/{ide-ux → pm-plugins/ide-ux}/quote-handling.d.ts +0 -0
- /package/dist/types/{language-list.d.ts → pm-plugins/language-list.d.ts} +0 -0
- /package/dist/types/{plugin-key.d.ts → pm-plugins/plugin-key.d.ts} +0 -0
- /package/dist/types/{refresh-browser-selection.d.ts → pm-plugins/refresh-browser-selection.d.ts} +0 -0
- /package/dist/types/{transform-to-code-block.d.ts → pm-plugins/transform-to-code-block.d.ts} +0 -0
- /package/dist/types/{utils.d.ts → pm-plugins/utils.d.ts} +0 -0
- /package/dist/types/{types.d.ts → types/index.d.ts} +0 -0
- /package/dist/types-ts4.5/{actions.d.ts → editor-commands/index.d.ts} +0 -0
- /package/dist/types-ts4.5/{ide-ux → pm-plugins/ide-ux}/bracket-handling.d.ts +0 -0
- /package/dist/types-ts4.5/{ide-ux → pm-plugins/ide-ux}/commands.d.ts +0 -0
- /package/dist/types-ts4.5/{ide-ux → pm-plugins/ide-ux}/line-handling.d.ts +0 -0
- /package/dist/types-ts4.5/{ide-ux → pm-plugins/ide-ux}/paired-character-handling.d.ts +0 -0
- /package/dist/types-ts4.5/{ide-ux → pm-plugins/ide-ux}/quote-handling.d.ts +0 -0
- /package/dist/types-ts4.5/{language-list.d.ts → pm-plugins/language-list.d.ts} +0 -0
- /package/dist/types-ts4.5/{plugin-key.d.ts → pm-plugins/plugin-key.d.ts} +0 -0
- /package/dist/types-ts4.5/{refresh-browser-selection.d.ts → pm-plugins/refresh-browser-selection.d.ts} +0 -0
- /package/dist/types-ts4.5/{transform-to-code-block.d.ts → pm-plugins/transform-to-code-block.d.ts} +0 -0
- /package/dist/types-ts4.5/{utils.d.ts → pm-plugins/utils.d.ts} +0 -0
- /package/dist/types-ts4.5/{types.d.ts → types/index.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 3.5.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#168198](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168198)
|
|
8
|
+
[`c191e2b8a81ea`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c191e2b8a81ea) -
|
|
9
|
+
ED-25807: refactors plugins to meet folder standards
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.5.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 3.5.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -12,15 +12,15 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
14
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
-
var
|
|
15
|
+
var _editorCommands = require("./editor-commands");
|
|
16
16
|
var _codeBlockAutoFullStopTransformPlugin = require("./pm-plugins/codeBlockAutoFullStopTransformPlugin");
|
|
17
17
|
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
18
18
|
var _ideUx = _interopRequireDefault(require("./pm-plugins/ide-ux"));
|
|
19
19
|
var _inputRule = require("./pm-plugins/input-rule");
|
|
20
20
|
var _keymaps = _interopRequireDefault(require("./pm-plugins/keymaps"));
|
|
21
21
|
var _main = require("./pm-plugins/main");
|
|
22
|
-
var _refreshBrowserSelection = _interopRequireDefault(require("./refresh-browser-selection"));
|
|
23
|
-
var _toolbar = require("./toolbar");
|
|
22
|
+
var _refreshBrowserSelection = _interopRequireDefault(require("./pm-plugins/refresh-browser-selection"));
|
|
23
|
+
var _toolbar = require("./pm-plugins/toolbar");
|
|
24
24
|
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; }
|
|
25
25
|
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; }
|
|
26
26
|
var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
@@ -87,7 +87,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
87
87
|
*/
|
|
88
88
|
insertCodeBlock: function insertCodeBlock(inputMethod) {
|
|
89
89
|
var _api$analytics2;
|
|
90
|
-
return (0,
|
|
90
|
+
return (0, _editorCommands.insertCodeBlockWithAnalytics)(inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingInQuoteSupported);
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
pluginsOptions: {
|
|
@@ -105,7 +105,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
105
105
|
},
|
|
106
106
|
action: function action(_insert, state) {
|
|
107
107
|
var _api$analytics3;
|
|
108
|
-
var tr = (0,
|
|
108
|
+
var tr = (0, _editorCommands.createInsertCodeBlockTransaction)({
|
|
109
109
|
state: state,
|
|
110
110
|
isNestingInQuoteSupported: isNestingInQuoteSupported
|
|
111
111
|
});
|
|
@@ -16,11 +16,11 @@ var _insert = require("@atlaskit/editor-common/insert");
|
|
|
16
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
18
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var _transformToCodeBlock = require("
|
|
23
|
-
var _utils2 = require("
|
|
19
|
+
var _actions = require("../pm-plugins/actions");
|
|
20
|
+
var _codeBlockCopySelectionPlugin = require("../pm-plugins/codeBlockCopySelectionPlugin");
|
|
21
|
+
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
22
|
+
var _transformToCodeBlock = require("../pm-plugins/transform-to-code-block");
|
|
23
|
+
var _utils2 = require("../pm-plugins/utils");
|
|
24
24
|
var removeCodeBlock = exports.removeCodeBlock = function removeCodeBlock(state, dispatch) {
|
|
25
25
|
var nodes = state.schema.nodes,
|
|
26
26
|
tr = state.tr;
|
package/dist/cjs/index.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
Object.defineProperty(exports, "codeBlockPlugin", {
|
|
8
8
|
enumerable: true,
|
|
9
9
|
get: function get() {
|
|
10
|
-
return
|
|
10
|
+
return _codeBlockPlugin.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
var
|
|
13
|
+
var _codeBlockPlugin = _interopRequireDefault(require("./codeBlockPlugin"));
|
|
@@ -13,7 +13,7 @@ var _browser = require("@atlaskit/editor-common/browser");
|
|
|
13
13
|
var _codeBlock = require("@atlaskit/editor-common/code-block");
|
|
14
14
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
-
var
|
|
16
|
+
var _editorCommands = require("../editor-commands");
|
|
17
17
|
var _mainState = require("../pm-plugins/main-state");
|
|
18
18
|
var _classNames = require("../ui/class-names");
|
|
19
19
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
@@ -184,7 +184,7 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
|
|
|
184
184
|
}
|
|
185
185
|
if (_browser.browser.android) {
|
|
186
186
|
this.coalesceDOMElements();
|
|
187
|
-
(0,
|
|
187
|
+
(0, _editorCommands.resetShouldIgnoreFollowingMutations)(this.view.state, this.view.dispatch);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
return true;
|
|
@@ -9,7 +9,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
-
var _utils2 = require("
|
|
12
|
+
var _utils2 = require("./utils");
|
|
13
13
|
var codeBlockAutoFullStopTransformPluginKey = exports.codeBlockAutoFullStopTransformPluginKey = new _state.PluginKey('codeBlockAutoFullStopTransformPluginKey');
|
|
14
14
|
function codeBlockAutoFullStopTransformPlugin() {
|
|
15
15
|
return new _safePlugin.SafePlugin({
|
|
@@ -10,7 +10,7 @@ var _codeBlock = require("@atlaskit/editor-common/code-block");
|
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
12
|
var _classNames = require("../ui/class-names");
|
|
13
|
-
var _utils = require("
|
|
13
|
+
var _utils = require("./utils");
|
|
14
14
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
15
15
|
|
|
16
16
|
var DECORATION_WIDGET_TYPE = exports.DECORATION_WIDGET_TYPE = 'decorationWidgetType';
|
|
@@ -9,12 +9,12 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
9
9
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
12
|
-
var _bracketHandling = require("
|
|
13
|
-
var _commands = require("
|
|
14
|
-
var _lineHandling = require("
|
|
15
|
-
var _pairedCharacterHandling = require("
|
|
16
|
-
var _quoteHandling = require("
|
|
17
|
-
var _utils3 = require("
|
|
12
|
+
var _bracketHandling = require("./ide-ux/bracket-handling");
|
|
13
|
+
var _commands = require("./ide-ux/commands");
|
|
14
|
+
var _lineHandling = require("./ide-ux/line-handling");
|
|
15
|
+
var _pairedCharacterHandling = require("./ide-ux/paired-character-handling");
|
|
16
|
+
var _quoteHandling = require("./ide-ux/quote-handling");
|
|
17
|
+
var _utils3 = require("./utils");
|
|
18
18
|
var ideUX = function ideUX(pluginInjectionApi) {
|
|
19
19
|
var _pluginInjectionApi$a;
|
|
20
20
|
var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
@@ -10,7 +10,7 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
12
12
|
var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
|
|
13
|
-
var _transformToCodeBlock = require("
|
|
13
|
+
var _transformToCodeBlock = require("./transform-to-code-block");
|
|
14
14
|
function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingInQuoteSupported) {
|
|
15
15
|
var rules = getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported);
|
|
16
16
|
return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('code-block-input-rule', rules, {
|
|
@@ -10,7 +10,7 @@ var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
-
var _utils3 = require("
|
|
13
|
+
var _utils3 = require("./utils");
|
|
14
14
|
var deleteCurrentItem = function deleteCurrentItem($from) {
|
|
15
15
|
return function (tr) {
|
|
16
16
|
return tr.delete($from.before($from.depth), $from.after($from.depth));
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getPluginState = void 0;
|
|
7
|
-
var _pluginKey = require("
|
|
7
|
+
var _pluginKey = require("./plugin-key");
|
|
8
8
|
var getPluginState = exports.getPluginState = function getPluginState(state) {
|
|
9
9
|
return _pluginKey.pluginKey.getState(state);
|
|
10
10
|
};
|
|
@@ -14,13 +14,13 @@ var _selection = require("@atlaskit/editor-common/selection");
|
|
|
14
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
15
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
-
var
|
|
17
|
+
var _editorCommands = require("../editor-commands");
|
|
18
18
|
var _codeBlock2 = require("../nodeviews/code-block");
|
|
19
|
-
var _pluginKey = require("../plugin-key");
|
|
20
19
|
var _classNames = require("../ui/class-names");
|
|
21
|
-
var
|
|
22
|
-
var _actions2 = require("./actions");
|
|
20
|
+
var _actions = require("./actions");
|
|
23
21
|
var _decorators = require("./decorators");
|
|
22
|
+
var _pluginKey = require("./plugin-key");
|
|
23
|
+
var _utils = require("./utils");
|
|
24
24
|
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; }
|
|
25
25
|
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; } /* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
26
26
|
var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
@@ -60,12 +60,12 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
60
60
|
}, 0);
|
|
61
61
|
} else {
|
|
62
62
|
// Middle of paragraph, end of line
|
|
63
|
-
(0,
|
|
63
|
+
(0, _editorCommands.ignoreFollowingMutations)(view.state, view.dispatch);
|
|
64
64
|
}
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
67
67
|
if (_browser.browser.android) {
|
|
68
|
-
(0,
|
|
68
|
+
(0, _editorCommands.resetShouldIgnoreFollowingMutations)(view.state, view.dispatch);
|
|
69
69
|
}
|
|
70
70
|
return false;
|
|
71
71
|
};
|
|
@@ -85,7 +85,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
85
85
|
},
|
|
86
86
|
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
87
87
|
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
88
|
-
if ((meta === null || meta === void 0 ? void 0 : meta.type) ===
|
|
88
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_IS_WRAPPED && (0, _platformFeatureFlags.fg)('editor_support_code_block_wrapping')) {
|
|
89
89
|
var node = (0, _utils.findCodeBlock)(newState, tr.selection);
|
|
90
90
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
91
91
|
decorations: (0, _decorators.updateDecorationSetWithWordWrappedDecorator)(pluginState.decorations, tr, node)
|
|
@@ -121,11 +121,11 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
121
121
|
});
|
|
122
122
|
return _newPluginState;
|
|
123
123
|
}
|
|
124
|
-
if ((meta === null || meta === void 0 ? void 0 : meta.type) ===
|
|
124
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_COPIED_TO_CLIPBOARD) {
|
|
125
125
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
126
126
|
contentCopied: meta.data
|
|
127
127
|
});
|
|
128
|
-
} else if ((meta === null || meta === void 0 ? void 0 : meta.type) ===
|
|
128
|
+
} else if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_SHOULD_IGNORE_FOLLOWING_MUTATIONS) {
|
|
129
129
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
130
130
|
shouldIgnoreFollowingMutations: meta.data
|
|
131
131
|
});
|
|
@@ -14,11 +14,11 @@ var _copy = _interopRequireDefault(require("@atlaskit/icon/core/migration/copy")
|
|
|
14
14
|
var _textWrap = _interopRequireDefault(require("@atlaskit/icon/core/text-wrap"));
|
|
15
15
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
-
var
|
|
17
|
+
var _editorCommands = require("../editor-commands");
|
|
18
|
+
var _WrapIcon = require("../ui/icons/WrapIcon");
|
|
19
|
+
var _codeBlockCopySelectionPlugin = require("./codeBlockCopySelectionPlugin");
|
|
18
20
|
var _languageList = require("./language-list");
|
|
19
21
|
var _pluginKey = require("./plugin-key");
|
|
20
|
-
var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
|
|
21
|
-
var _WrapIcon = require("./ui/icons/WrapIcon");
|
|
22
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
24
|
var languageList = (0, _languageList.createLanguageList)(_languageList.DEFAULT_LANGUAGES);
|
|
@@ -62,7 +62,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
62
62
|
type: 'select',
|
|
63
63
|
selectType: 'list',
|
|
64
64
|
onChange: function onChange(option) {
|
|
65
|
-
return (0,
|
|
65
|
+
return (0, _editorCommands.changeLanguage)(editorAnalyticsAPI)(option.value);
|
|
66
66
|
},
|
|
67
67
|
defaultValue: defaultValue,
|
|
68
68
|
placeholder: formatMessage(_messages.codeBlockButtonMessages.selectLanguage),
|
|
@@ -80,12 +80,12 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
80
80
|
icon: _copy.default,
|
|
81
81
|
// note: copyContentToClipboard contains logic that also removes the
|
|
82
82
|
// visual feedback for the copy button
|
|
83
|
-
onClick:
|
|
83
|
+
onClick: _editorCommands.copyContentToClipboard,
|
|
84
84
|
title: formatMessage(codeBlockState.contentCopied ? _messages.codeBlockButtonMessages.copiedCodeToClipboard : _messages.codeBlockButtonMessages.copyCodeToClipboard),
|
|
85
85
|
onMouseEnter: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
86
86
|
// note: resetCopiedState contains logic that also removes the
|
|
87
87
|
// visual feedback for the copy button
|
|
88
|
-
onMouseLeave:
|
|
88
|
+
onMouseLeave: _editorCommands.resetCopiedState,
|
|
89
89
|
onFocus: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
|
|
90
90
|
onBlur: _codeBlockCopySelectionPlugin.removeVisualFeedbackForCopyButton,
|
|
91
91
|
hideTooltipOnClick: false,
|
|
@@ -102,7 +102,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
102
102
|
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
103
103
|
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
104
104
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
105
|
-
onClick:
|
|
105
|
+
onClick: _editorCommands.removeCodeBlock,
|
|
106
106
|
title: formatMessage(_messages.default.remove),
|
|
107
107
|
tabIndex: null
|
|
108
108
|
};
|
|
@@ -112,7 +112,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
|
|
|
112
112
|
supportsViewMode: true,
|
|
113
113
|
icon: _textWrap.default,
|
|
114
114
|
iconFallback: _WrapIcon.WrapIcon,
|
|
115
|
-
onClick: (0,
|
|
115
|
+
onClick: (0, _editorCommands.toggleWordWrapStateForCodeBlockNode)(editorAnalyticsAPI),
|
|
116
116
|
title: isWrapped ? formatMessage(_messages.codeBlockButtonMessages.unwrapCode) : formatMessage(_messages.codeBlockButtonMessages.wrapCode),
|
|
117
117
|
tabIndex: null,
|
|
118
118
|
selected: isWrapped
|
|
@@ -4,15 +4,15 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { IconCode } from '@atlaskit/editor-common/quick-insert';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
-
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './
|
|
7
|
+
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
|
|
8
8
|
import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
|
|
9
9
|
import { codeBlockCopySelectionPlugin } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
10
10
|
import ideUX from './pm-plugins/ide-ux';
|
|
11
11
|
import { createCodeBlockInputRule } from './pm-plugins/input-rule';
|
|
12
12
|
import keymap from './pm-plugins/keymaps';
|
|
13
13
|
import { createPlugin } from './pm-plugins/main';
|
|
14
|
-
import refreshBrowserSelectionOnChange from './refresh-browser-selection';
|
|
15
|
-
import { getToolbarConfig } from './toolbar';
|
|
14
|
+
import refreshBrowserSelectionOnChange from './pm-plugins/refresh-browser-selection';
|
|
15
|
+
import { getToolbarConfig } from './pm-plugins/toolbar';
|
|
16
16
|
const codeBlockPlugin = ({
|
|
17
17
|
config: options,
|
|
18
18
|
api
|
|
@@ -6,11 +6,11 @@ import { contentAllowedInCodeBlock, shouldSplitSelectedNodeOnNodeInsertion } fro
|
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { findParentNodeOfType, findSelectedNodeOfType, isNodeSelection, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { transformToCodeBlockAction } from '
|
|
13
|
-
import { findCodeBlock } from '
|
|
9
|
+
import { ACTIONS } from '../pm-plugins/actions';
|
|
10
|
+
import { copySelectionPluginKey } from '../pm-plugins/codeBlockCopySelectionPlugin';
|
|
11
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
12
|
+
import { transformToCodeBlockAction } from '../pm-plugins/transform-to-code-block';
|
|
13
|
+
import { findCodeBlock } from '../pm-plugins/utils';
|
|
14
14
|
export const removeCodeBlock = (state, dispatch) => {
|
|
15
15
|
const {
|
|
16
16
|
schema: {
|
package/dist/es2019/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as codeBlockPlugin } from './
|
|
1
|
+
export { default as codeBlockPlugin } from './codeBlockPlugin';
|
|
@@ -5,7 +5,7 @@ import { browser } from '@atlaskit/editor-common/browser';
|
|
|
5
5
|
import { codeBlockWrappedStates, defaultWordWrapState, transferCodeBlockWrappedValue } from '@atlaskit/editor-common/code-block';
|
|
6
6
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { resetShouldIgnoreFollowingMutations } from '../
|
|
8
|
+
import { resetShouldIgnoreFollowingMutations } from '../editor-commands';
|
|
9
9
|
import { getPluginState } from '../pm-plugins/main-state';
|
|
10
10
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
11
11
|
const MATCH_NEWLINES = new RegExp('\n', 'g');
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import { findCodeBlock } from '
|
|
5
|
+
import { findCodeBlock } from './utils';
|
|
6
6
|
export const codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
|
|
7
7
|
export function codeBlockAutoFullStopTransformPlugin() {
|
|
8
8
|
return new SafePlugin({
|
|
@@ -4,7 +4,7 @@ import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
|
|
|
4
4
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
7
|
-
import { getAllCodeBlockNodesInDoc } from '
|
|
7
|
+
import { getAllCodeBlockNodesInDoc } from './utils';
|
|
8
8
|
export const DECORATION_WIDGET_TYPE = 'decorationWidgetType';
|
|
9
9
|
export const DECORATION_WRAPPED_BLOCK_NODE_TYPE = 'decorationNodeType';
|
|
10
10
|
|
|
@@ -3,12 +3,12 @@ import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '
|
|
7
|
-
import { indent, insertIndent, insertNewlineWithIndent, outdent } from '
|
|
8
|
-
import { getEndOfCurrentLine, getLineInfo, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock } from '
|
|
9
|
-
import { isClosingCharacter, isCursorBeforeClosingCharacter } from '
|
|
10
|
-
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '
|
|
11
|
-
import { getCursor } from '
|
|
6
|
+
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from './ide-ux/bracket-handling';
|
|
7
|
+
import { indent, insertIndent, insertNewlineWithIndent, outdent } from './ide-ux/commands';
|
|
8
|
+
import { getEndOfCurrentLine, getLineInfo, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock } from './ide-ux/line-handling';
|
|
9
|
+
import { isClosingCharacter, isCursorBeforeClosingCharacter } from './ide-ux/paired-character-handling';
|
|
10
|
+
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from './ide-ux/quote-handling';
|
|
11
|
+
import { getCursor } from './utils';
|
|
12
12
|
const ideUX = pluginInjectionApi => {
|
|
13
13
|
var _pluginInjectionApi$a;
|
|
14
14
|
const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
@@ -4,7 +4,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
4
4
|
import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
7
|
-
import { isConvertableToCodeBlock, transformToCodeBlockAction } from '
|
|
7
|
+
import { isConvertableToCodeBlock, transformToCodeBlockAction } from './transform-to-code-block';
|
|
8
8
|
export function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingInQuoteSupported) {
|
|
9
9
|
const rules = getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported);
|
|
10
10
|
return new SafePlugin(createPlugin('code-block-input-rule', rules, {
|
|
@@ -3,7 +3,7 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
|
3
3
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { getCursor } from '
|
|
6
|
+
import { getCursor } from './utils';
|
|
7
7
|
const deleteCurrentItem = $from => tr => {
|
|
8
8
|
return tr.delete($from.before($from.depth), $from.after($from.depth));
|
|
9
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { pluginKey } from '
|
|
1
|
+
import { pluginKey } from './plugin-key';
|
|
2
2
|
export const getPluginState = state => pluginKey.getState(state);
|
|
@@ -8,13 +8,13 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
|
8
8
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
-
import { ignoreFollowingMutations, resetShouldIgnoreFollowingMutations } from '../
|
|
11
|
+
import { ignoreFollowingMutations, resetShouldIgnoreFollowingMutations } from '../editor-commands';
|
|
12
12
|
import { codeBlockNodeView } from '../nodeviews/code-block';
|
|
13
|
-
import { pluginKey } from '../plugin-key';
|
|
14
13
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
15
|
-
import { findCodeBlock, getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from '../utils';
|
|
16
14
|
import { ACTIONS } from './actions';
|
|
17
15
|
import { generateInitialDecorations, updateCodeBlockDecorations, updateDecorationSetWithWordWrappedDecorator } from './decorators';
|
|
16
|
+
import { pluginKey } from './plugin-key';
|
|
17
|
+
import { findCodeBlock, getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from './utils';
|
|
18
18
|
export const createPlugin = ({
|
|
19
19
|
useLongPressSelection = false,
|
|
20
20
|
getIntl,
|
|
@@ -6,11 +6,11 @@ import CopyIcon from '@atlaskit/icon/core/migration/copy';
|
|
|
6
6
|
import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
|
|
7
7
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { changeLanguage, copyContentToClipboard, removeCodeBlock, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '
|
|
9
|
+
import { changeLanguage, copyContentToClipboard, removeCodeBlock, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
|
|
10
|
+
import { WrapIcon } from '../ui/icons/WrapIcon';
|
|
11
|
+
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './codeBlockCopySelectionPlugin';
|
|
10
12
|
import { createLanguageList, DEFAULT_LANGUAGES, getLanguageIdentifier } from './language-list';
|
|
11
13
|
import { pluginKey } from './plugin-key';
|
|
12
|
-
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
13
|
-
import { WrapIcon } from './ui/icons/WrapIcon';
|
|
14
14
|
const languageList = createLanguageList(DEFAULT_LANGUAGES);
|
|
15
15
|
export const getToolbarConfig = (allowCopyToClipboard = false, api) => (state, {
|
|
16
16
|
formatMessage
|
|
@@ -7,15 +7,15 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
7
7
|
import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { IconCode } from '@atlaskit/editor-common/quick-insert';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './
|
|
10
|
+
import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
|
|
11
11
|
import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
|
|
12
12
|
import { codeBlockCopySelectionPlugin } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
13
13
|
import ideUX from './pm-plugins/ide-ux';
|
|
14
14
|
import { createCodeBlockInputRule } from './pm-plugins/input-rule';
|
|
15
15
|
import keymap from './pm-plugins/keymaps';
|
|
16
16
|
import { createPlugin } from './pm-plugins/main';
|
|
17
|
-
import refreshBrowserSelectionOnChange from './refresh-browser-selection';
|
|
18
|
-
import { getToolbarConfig } from './toolbar';
|
|
17
|
+
import refreshBrowserSelectionOnChange from './pm-plugins/refresh-browser-selection';
|
|
18
|
+
import { getToolbarConfig } from './pm-plugins/toolbar';
|
|
19
19
|
var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
20
20
|
var _api$featureFlags;
|
|
21
21
|
var options = _ref.config,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,11 +6,11 @@ import { contentAllowedInCodeBlock, shouldSplitSelectedNodeOnNodeInsertion } fro
|
|
|
6
6
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { findParentNodeOfType, findSelectedNodeOfType, isNodeSelection, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { transformToCodeBlockAction } from '
|
|
13
|
-
import { findCodeBlock } from '
|
|
9
|
+
import { ACTIONS } from '../pm-plugins/actions';
|
|
10
|
+
import { copySelectionPluginKey } from '../pm-plugins/codeBlockCopySelectionPlugin';
|
|
11
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
12
|
+
import { transformToCodeBlockAction } from '../pm-plugins/transform-to-code-block';
|
|
13
|
+
import { findCodeBlock } from '../pm-plugins/utils';
|
|
14
14
|
export var removeCodeBlock = function removeCodeBlock(state, dispatch) {
|
|
15
15
|
var nodes = state.schema.nodes,
|
|
16
16
|
tr = state.tr;
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as codeBlockPlugin } from './
|
|
1
|
+
export { default as codeBlockPlugin } from './codeBlockPlugin';
|
|
@@ -7,7 +7,7 @@ import { browser } from '@atlaskit/editor-common/browser';
|
|
|
7
7
|
import { codeBlockWrappedStates, defaultWordWrapState, transferCodeBlockWrappedValue } from '@atlaskit/editor-common/code-block';
|
|
8
8
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import { resetShouldIgnoreFollowingMutations } from '../
|
|
10
|
+
import { resetShouldIgnoreFollowingMutations } from '../editor-commands';
|
|
11
11
|
import { getPluginState } from '../pm-plugins/main-state';
|
|
12
12
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
13
13
|
var MATCH_NEWLINES = new RegExp('\n', 'g');
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
import { findCodeBlock } from '
|
|
5
|
+
import { findCodeBlock } from './utils';
|
|
6
6
|
export var codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
|
|
7
7
|
export function codeBlockAutoFullStopTransformPlugin() {
|
|
8
8
|
return new SafePlugin({
|
|
@@ -5,7 +5,7 @@ import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
|
|
|
5
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
8
|
-
import { getAllCodeBlockNodesInDoc } from '
|
|
8
|
+
import { getAllCodeBlockNodesInDoc } from './utils';
|
|
9
9
|
export var DECORATION_WIDGET_TYPE = 'decorationWidgetType';
|
|
10
10
|
export var DECORATION_WRAPPED_BLOCK_NODE_TYPE = 'decorationNodeType';
|
|
11
11
|
|
|
@@ -3,12 +3,12 @@ import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '
|
|
7
|
-
import { indent, insertIndent, insertNewlineWithIndent, outdent } from '
|
|
8
|
-
import { getEndOfCurrentLine, getLineInfo, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock } from '
|
|
9
|
-
import { isClosingCharacter, isCursorBeforeClosingCharacter } from '
|
|
10
|
-
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '
|
|
11
|
-
import { getCursor } from '
|
|
6
|
+
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from './ide-ux/bracket-handling';
|
|
7
|
+
import { indent, insertIndent, insertNewlineWithIndent, outdent } from './ide-ux/commands';
|
|
8
|
+
import { getEndOfCurrentLine, getLineInfo, getStartOfCurrentLine, isCursorInsideCodeBlock, isSelectionEntirelyInsideCodeBlock } from './ide-ux/line-handling';
|
|
9
|
+
import { isClosingCharacter, isCursorBeforeClosingCharacter } from './ide-ux/paired-character-handling';
|
|
10
|
+
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from './ide-ux/quote-handling';
|
|
11
|
+
import { getCursor } from './utils';
|
|
12
12
|
var ideUX = function ideUX(pluginInjectionApi) {
|
|
13
13
|
var _pluginInjectionApi$a;
|
|
14
14
|
var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
|
|
@@ -4,7 +4,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
4
4
|
import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
6
6
|
import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
|
|
7
|
-
import { isConvertableToCodeBlock, transformToCodeBlockAction } from '
|
|
7
|
+
import { isConvertableToCodeBlock, transformToCodeBlockAction } from './transform-to-code-block';
|
|
8
8
|
export function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingInQuoteSupported) {
|
|
9
9
|
var rules = getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported);
|
|
10
10
|
return new SafePlugin(createPlugin('code-block-input-rule', rules, {
|
|
@@ -3,7 +3,7 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
|
3
3
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { getCursor } from '
|
|
6
|
+
import { getCursor } from './utils';
|
|
7
7
|
var deleteCurrentItem = function deleteCurrentItem($from) {
|
|
8
8
|
return function (tr) {
|
|
9
9
|
return tr.delete($from.before($from.depth), $from.after($from.depth));
|
|
@@ -11,13 +11,13 @@ import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
|
11
11
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
-
import { ignoreFollowingMutations, resetShouldIgnoreFollowingMutations } from '../
|
|
14
|
+
import { ignoreFollowingMutations, resetShouldIgnoreFollowingMutations } from '../editor-commands';
|
|
15
15
|
import { codeBlockNodeView } from '../nodeviews/code-block';
|
|
16
|
-
import { pluginKey } from '../plugin-key';
|
|
17
16
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
18
|
-
import { findCodeBlock, getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from '../utils';
|
|
19
17
|
import { ACTIONS } from './actions';
|
|
20
18
|
import { generateInitialDecorations, updateCodeBlockDecorations, updateDecorationSetWithWordWrappedDecorator } from './decorators';
|
|
19
|
+
import { pluginKey } from './plugin-key';
|
|
20
|
+
import { findCodeBlock, getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from './utils';
|
|
21
21
|
export var createPlugin = function createPlugin(_ref) {
|
|
22
22
|
var _ref$useLongPressSele = _ref.useLongPressSelection,
|
|
23
23
|
useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
|
|
@@ -6,11 +6,11 @@ import CopyIcon from '@atlaskit/icon/core/migration/copy';
|
|
|
6
6
|
import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
|
|
7
7
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
-
import { changeLanguage, copyContentToClipboard, removeCodeBlock, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '
|
|
9
|
+
import { changeLanguage, copyContentToClipboard, removeCodeBlock, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
|
|
10
|
+
import { WrapIcon } from '../ui/icons/WrapIcon';
|
|
11
|
+
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './codeBlockCopySelectionPlugin';
|
|
10
12
|
import { createLanguageList, DEFAULT_LANGUAGES, getLanguageIdentifier } from './language-list';
|
|
11
13
|
import { pluginKey } from './plugin-key';
|
|
12
|
-
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
13
|
-
import { WrapIcon } from './ui/icons/WrapIcon';
|
|
14
14
|
var languageList = createLanguageList(DEFAULT_LANGUAGES);
|
|
15
15
|
export var getToolbarConfig = function getToolbarConfig() {
|
|
16
16
|
var allowCopyToClipboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
@@ -19,5 +19,3 @@ export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
|
|
|
19
19
|
insertCodeBlock: (inputMethod: INPUT_METHOD) => Command;
|
|
20
20
|
};
|
|
21
21
|
}>;
|
|
22
|
-
declare const codeBlockPlugin: CodeBlockPlugin;
|
|
23
|
-
export default codeBlockPlugin;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as codeBlockPlugin } from './
|
|
2
|
-
export type { CodeBlockPlugin } from './
|
|
1
|
+
export { default as codeBlockPlugin } from './codeBlockPlugin';
|
|
2
|
+
export type { CodeBlockPlugin } from './codeBlockPluginType';
|
|
3
3
|
export type { CodeBlockOptions } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { CodeBlockPlugin } from '../
|
|
4
|
+
import type { CodeBlockPlugin } from '../codeBlockPluginType';
|
|
5
5
|
export declare class CodeBlockView {
|
|
6
6
|
private cleanupEditorDisabledListener?;
|
|
7
7
|
node: Node;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI, FloatingToolbarHandler, SelectOption } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { CodeBlockPlugin } from '
|
|
2
|
+
import type { CodeBlockPlugin } from '../index';
|
|
3
3
|
export declare const getToolbarConfig: (allowCopyToClipboard: boolean | undefined, api: ExtractInjectionAPI<CodeBlockPlugin> | undefined) => FloatingToolbarHandler;
|
|
4
4
|
/**
|
|
5
5
|
* Filters language list based on both name and alias properties.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
@@ -19,5 +19,3 @@ export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
|
|
|
19
19
|
insertCodeBlock: (inputMethod: INPUT_METHOD) => Command;
|
|
20
20
|
};
|
|
21
21
|
}>;
|
|
22
|
-
declare const codeBlockPlugin: CodeBlockPlugin;
|
|
23
|
-
export default codeBlockPlugin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as codeBlockPlugin } from './
|
|
2
|
-
export type { CodeBlockPlugin } from './
|
|
1
|
+
export { default as codeBlockPlugin } from './codeBlockPlugin';
|
|
2
|
+
export type { CodeBlockPlugin } from './codeBlockPluginType';
|
|
3
3
|
export type { CodeBlockOptions } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { CodeBlockPlugin } from '../
|
|
4
|
+
import type { CodeBlockPlugin } from '../codeBlockPluginType';
|
|
5
5
|
export declare class CodeBlockView {
|
|
6
6
|
private cleanupEditorDisabledListener?;
|
|
7
7
|
node: Node;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI, FloatingToolbarHandler, SelectOption } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { CodeBlockPlugin } from '
|
|
2
|
+
import type { CodeBlockPlugin } from '../index';
|
|
3
3
|
export declare const getToolbarConfig: (allowCopyToClipboard: boolean | undefined, api: ExtractInjectionAPI<CodeBlockPlugin> | undefined) => FloatingToolbarHandler;
|
|
4
4
|
/**
|
|
5
5
|
* Filters language list based on both name and alias properties.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.6",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^44.2.0",
|
|
35
35
|
"@atlaskit/code": "^15.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
36
|
+
"@atlaskit/editor-common": "^95.6.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
38
38
|
"@atlaskit/editor-plugin-composition": "^1.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^1.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
42
|
-
"@atlaskit/icon": "^22.
|
|
42
|
+
"@atlaskit/icon": "^22.26.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
44
44
|
"@atlaskit/prosemirror-input-rules": "^3.2.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
@@ -54,6 +54,9 @@
|
|
|
54
54
|
},
|
|
55
55
|
"techstack": {
|
|
56
56
|
"@atlassian/frontend": {
|
|
57
|
+
"code-structure": [
|
|
58
|
+
"editor-plugin"
|
|
59
|
+
],
|
|
57
60
|
"import-structure": [
|
|
58
61
|
"atlassian-conventions"
|
|
59
62
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/es2019/{refresh-browser-selection.js → pm-plugins/refresh-browser-selection.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/{refresh-browser-selection.d.ts → pm-plugins/refresh-browser-selection.d.ts}
RENAMED
|
File without changes
|
/package/dist/types/{transform-to-code-block.d.ts → pm-plugins/transform-to-code-block.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types-ts4.5/{transform-to-code-block.d.ts → pm-plugins/transform-to-code-block.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|