@atlaskit/editor-plugin-code-block 3.5.10 → 3.5.12

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 3.5.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.5.11
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 3.5.10
4
16
 
5
17
  ### Patch Changes
@@ -13,13 +13,13 @@ var _clipboard = require("@atlaskit/editor-common/clipboard");
13
13
  var _codeBlock = require("@atlaskit/editor-common/code-block");
14
14
  var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
15
15
  var _insert = require("@atlaskit/editor-common/insert");
16
+ var _transforms = require("@atlaskit/editor-common/transforms");
16
17
  var _state = require("@atlaskit/editor-prosemirror/state");
17
18
  var _utils = require("@atlaskit/editor-prosemirror/utils");
18
19
  var _actions = require("../pm-plugins/actions");
19
20
  var _codeBlockCopySelectionPlugin = require("../pm-plugins/codeBlockCopySelectionPlugin");
20
21
  var _pluginKey = require("../pm-plugins/plugin-key");
21
22
  var _transformToCodeBlock = require("../pm-plugins/transform-to-code-block");
22
- var _utils2 = require("../pm-plugins/utils");
23
23
  var removeCodeBlock = exports.removeCodeBlock = function removeCodeBlock(state, dispatch) {
24
24
  var nodes = state.schema.nodes,
25
25
  tr = state.tr;
@@ -197,7 +197,7 @@ function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI, isNestingInQuot
197
197
  var toggleWordWrapStateForCodeBlockNode = exports.toggleWordWrapStateForCodeBlockNode = function toggleWordWrapStateForCodeBlockNode(editorAnalyticsAPI) {
198
198
  return function (state, dispatch) {
199
199
  var _findCodeBlock;
200
- var codeBlockNode = (_findCodeBlock = (0, _utils2.findCodeBlock)(state)) === null || _findCodeBlock === void 0 ? void 0 : _findCodeBlock.node;
200
+ var codeBlockNode = (_findCodeBlock = (0, _transforms.findCodeBlock)(state)) === null || _findCodeBlock === void 0 ? void 0 : _findCodeBlock.node;
201
201
  var tr = state.tr;
202
202
  if (!_codeBlock.codeBlockWrappedStates || !codeBlockNode) {
203
203
  return false;
@@ -80,7 +80,7 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
80
80
  }
81
81
  this.handleEditorDisabledChanged();
82
82
  }
83
- (0, _createClass2.default)(CodeBlockView, [{
83
+ return (0, _createClass2.default)(CodeBlockView, [{
84
84
  key: "handleEditorDisabledChanged",
85
85
  value: function handleEditorDisabledChanged() {
86
86
  var _this$api,
@@ -181,7 +181,6 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
181
181
  this.cleanupEditorDisabledListener = undefined;
182
182
  }
183
183
  }]);
184
- return CodeBlockView;
185
184
  }();
186
185
  var codeBlockNodeView = exports.codeBlockNodeView = function codeBlockNodeView(node, view, getPos, formattedAriaLabel, api) {
187
186
  return new CodeBlockView(node, view, getPos, formattedAriaLabel, api);
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.codeBlockAutoFullStopTransformPlugin = codeBlockAutoFullStopTransformPlugin;
7
7
  exports.codeBlockAutoFullStopTransformPluginKey = void 0;
8
8
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
9
+ var _transforms = require("@atlaskit/editor-common/transforms");
9
10
  var _utils = require("@atlaskit/editor-common/utils");
10
11
  var _state = require("@atlaskit/editor-prosemirror/state");
11
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
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({
@@ -26,7 +26,7 @@ function codeBlockAutoFullStopTransformPlugin() {
26
26
  var _trNew$selection = trNew.selection,
27
27
  fromNew = _trNew$selection.from,
28
28
  toNew = _trNew$selection.to;
29
- var isCodeBlock = !!(0, _utils2.findCodeBlock)(oldState, trOld.selection) && !!(0, _utils2.findCodeBlock)(newState, trNew.selection);
29
+ var isCodeBlock = !!(0, _transforms.findCodeBlock)(oldState, trOld.selection) && !!(0, _transforms.findCodeBlock)(newState, trNew.selection);
30
30
 
31
31
  /**
32
32
  * Mac will auto insert a fullstop when the user double taps the space key after some content.
@@ -11,6 +11,7 @@ var _codeBlock = require("@atlaskit/editor-common/code-block");
11
11
  var _messages = require("@atlaskit/editor-common/messages");
12
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
13
  var _selection = require("@atlaskit/editor-common/selection");
14
+ var _transforms = require("@atlaskit/editor-common/transforms");
14
15
  var _state = require("@atlaskit/editor-prosemirror/state");
15
16
  var _view = require("@atlaskit/editor-prosemirror/view");
16
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -41,10 +42,10 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
41
42
  var eventText = keyEvent.data;
42
43
  if (_browser.browser.ios && event.composed &&
43
44
  // insertParagraph will be the input type when the enter key is pressed.
44
- eventInputType === 'insertParagraph' && (0, _utils.findCodeBlock)(view.state, view.state.selection)) {
45
+ eventInputType === 'insertParagraph' && (0, _transforms.findCodeBlock)(view.state, view.state.selection)) {
45
46
  event.preventDefault();
46
47
  return true;
47
- } else if (_browser.browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0, _utils.findCodeBlock)(view.state, view.state.selection)) {
48
+ } else if (_browser.browser.android && event.composed && eventInputType === 'insertCompositionText' && eventText[(eventText === null || eventText === void 0 ? void 0 : eventText.length) - 1] === '\n' && (0, _transforms.findCodeBlock)(view.state, view.state.selection)) {
48
49
  var resultingText = event.target.outerText + '\n';
49
50
  if (resultingText.endsWith(eventText)) {
50
51
  // End of paragraph
@@ -73,7 +74,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
73
74
  return new _safePlugin.SafePlugin({
74
75
  state: {
75
76
  init: function init(_, state) {
76
- var node = (0, _utils.findCodeBlock)(state, state.selection);
77
+ var node = (0, _transforms.findCodeBlock)(state, state.selection);
77
78
  var initialDecorations = (0, _decorators.generateInitialDecorations)(state);
78
79
  return {
79
80
  pos: node ? node.pos : null,
@@ -86,13 +87,13 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
86
87
  apply: function apply(tr, pluginState, _oldState, newState) {
87
88
  var meta = tr.getMeta(_pluginKey.pluginKey);
88
89
  if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_IS_WRAPPED) {
89
- var node = (0, _utils.findCodeBlock)(newState, tr.selection);
90
+ var node = (0, _transforms.findCodeBlock)(newState, tr.selection);
90
91
  return _objectSpread(_objectSpread({}, pluginState), {}, {
91
92
  decorations: (0, _decorators.updateDecorationSetWithWordWrappedDecorator)(pluginState.decorations, tr, node)
92
93
  });
93
94
  }
94
95
  if (tr.docChanged) {
95
- var _node = (0, _utils.findCodeBlock)(newState, tr.selection);
96
+ var _node = (0, _transforms.findCodeBlock)(newState, tr.selection);
96
97
 
97
98
  // Updates mapping position of all existing decorations to new positions
98
99
  // specifically used for updating word wrap node decorators (does not cover drag & drop, validateWordWrappedDecorators does).
@@ -112,7 +113,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
112
113
  return newPluginState;
113
114
  }
114
115
  if (tr.selectionSet) {
115
- var _node2 = (0, _utils.findCodeBlock)(newState, tr.selection);
116
+ var _node2 = (0, _transforms.findCodeBlock)(newState, tr.selection);
116
117
  var _newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
117
118
  pos: _node2 ? _node2.pos : null,
118
119
  isNodeSelected: tr.selection instanceof _state.NodeSelection
@@ -3,28 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "findCodeBlock", {
7
- enumerable: true,
8
- get: function get() {
9
- return _transforms.findCodeBlock;
10
- }
11
- });
12
6
  exports.getAllChangedCodeBlocksInTransaction = getAllChangedCodeBlocksInTransaction;
13
7
  exports.getAllCodeBlockNodesInDoc = getAllCodeBlockNodesInDoc;
14
8
  exports.getCursor = getCursor;
15
- Object.defineProperty(exports, "transformSingleLineCodeBlockToCodeMark", {
16
- enumerable: true,
17
- get: function get() {
18
- return _transforms.transformSingleLineCodeBlockToCodeMark;
19
- }
20
- });
21
- Object.defineProperty(exports, "transformSliceToJoinAdjacentCodeBlocks", {
22
- enumerable: true,
23
- get: function get() {
24
- return _transforms.transformSliceToJoinAdjacentCodeBlocks;
25
- }
26
- });
27
- var _transforms = require("@atlaskit/editor-common/transforms");
28
9
  function getCursor(selection) {
29
10
  return selection.$cursor || undefined;
30
11
  }
@@ -3,13 +3,13 @@ import { copyToClipboard } from '@atlaskit/editor-common/clipboard';
3
3
  import { codeBlockWrappedStates, isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
4
4
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
5
5
  import { contentAllowedInCodeBlock, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
6
+ import { findCodeBlock } from '@atlaskit/editor-common/transforms';
6
7
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
8
  import { findParentNodeOfType, findSelectedNodeOfType, isNodeSelection, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
8
9
  import { ACTIONS } from '../pm-plugins/actions';
9
10
  import { copySelectionPluginKey } from '../pm-plugins/codeBlockCopySelectionPlugin';
10
11
  import { pluginKey } from '../pm-plugins/plugin-key';
11
12
  import { transformToCodeBlockAction } from '../pm-plugins/transform-to-code-block';
12
- import { findCodeBlock } from '../pm-plugins/utils';
13
13
  export const removeCodeBlock = (state, dispatch) => {
14
14
  const {
15
15
  schema: {
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { default as codeBlockPlugin } from './codeBlockPlugin';
@@ -1,8 +1,8 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { findCodeBlock } from '@atlaskit/editor-common/transforms';
2
3
  import { browser } from '@atlaskit/editor-common/utils';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
5
  import { fg } from '@atlaskit/platform-feature-flags';
5
- import { findCodeBlock } from './utils';
6
6
  export const codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
7
7
  export function codeBlockAutoFullStopTransformPlugin() {
8
8
  return new SafePlugin({
@@ -5,6 +5,7 @@ import { updateCodeBlockWrappedStateNodeKeys } from '@atlaskit/editor-common/cod
5
5
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
6
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
7
7
  import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
8
+ import { findCodeBlock } from '@atlaskit/editor-common/transforms';
8
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
9
10
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
10
11
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -14,7 +15,7 @@ import { codeBlockClassNames } from '../ui/class-names';
14
15
  import { ACTIONS } from './actions';
15
16
  import { generateInitialDecorations, updateCodeBlockDecorations, updateDecorationSetWithWordWrappedDecorator } from './decorators';
16
17
  import { pluginKey } from './plugin-key';
17
- import { findCodeBlock, getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from './utils';
18
+ import { getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from './utils';
18
19
  export const createPlugin = ({
19
20
  useLongPressSelection = false,
20
21
  getIntl,
@@ -1,4 +1,3 @@
1
- export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '@atlaskit/editor-common/transforms';
2
1
  export function getCursor(selection) {
3
2
  return selection.$cursor || undefined;
4
3
  }
@@ -3,13 +3,13 @@ import { copyToClipboard } from '@atlaskit/editor-common/clipboard';
3
3
  import { codeBlockWrappedStates, isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
4
4
  import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
5
5
  import { contentAllowedInCodeBlock, shouldSplitSelectedNodeOnNodeInsertion } from '@atlaskit/editor-common/insert';
6
+ import { findCodeBlock } from '@atlaskit/editor-common/transforms';
6
7
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
8
  import { findParentNodeOfType, findSelectedNodeOfType, isNodeSelection, removeParentNodeOfType, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
8
9
  import { ACTIONS } from '../pm-plugins/actions';
9
10
  import { copySelectionPluginKey } from '../pm-plugins/codeBlockCopySelectionPlugin';
10
11
  import { pluginKey } from '../pm-plugins/plugin-key';
11
12
  import { transformToCodeBlockAction } from '../pm-plugins/transform-to-code-block';
12
- import { findCodeBlock } from '../pm-plugins/utils';
13
13
  export var removeCodeBlock = function removeCodeBlock(state, dispatch) {
14
14
  var nodes = state.schema.nodes,
15
15
  tr = state.tr;
package/dist/esm/index.js CHANGED
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { default as codeBlockPlugin } from './codeBlockPlugin';
@@ -73,7 +73,7 @@ export var CodeBlockView = /*#__PURE__*/function () {
73
73
  }
74
74
  this.handleEditorDisabledChanged();
75
75
  }
76
- _createClass(CodeBlockView, [{
76
+ return _createClass(CodeBlockView, [{
77
77
  key: "handleEditorDisabledChanged",
78
78
  value: function handleEditorDisabledChanged() {
79
79
  var _this$api,
@@ -174,7 +174,6 @@ export var CodeBlockView = /*#__PURE__*/function () {
174
174
  this.cleanupEditorDisabledListener = undefined;
175
175
  }
176
176
  }]);
177
- return CodeBlockView;
178
177
  }();
179
178
  export var codeBlockNodeView = function codeBlockNodeView(node, view, getPos, formattedAriaLabel, api) {
180
179
  return new CodeBlockView(node, view, getPos, formattedAriaLabel, api);
@@ -1,8 +1,8 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { findCodeBlock } from '@atlaskit/editor-common/transforms';
2
3
  import { browser } from '@atlaskit/editor-common/utils';
3
4
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
5
  import { fg } from '@atlaskit/platform-feature-flags';
5
- import { findCodeBlock } from './utils';
6
6
  export var codeBlockAutoFullStopTransformPluginKey = new PluginKey('codeBlockAutoFullStopTransformPluginKey');
7
7
  export function codeBlockAutoFullStopTransformPlugin() {
8
8
  return new SafePlugin({
@@ -8,6 +8,7 @@ import { updateCodeBlockWrappedStateNodeKeys } from '@atlaskit/editor-common/cod
8
8
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
9
9
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
10
10
  import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
11
+ import { findCodeBlock } from '@atlaskit/editor-common/transforms';
11
12
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
12
13
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
13
14
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -17,7 +18,7 @@ import { codeBlockClassNames } from '../ui/class-names';
17
18
  import { ACTIONS } from './actions';
18
19
  import { generateInitialDecorations, updateCodeBlockDecorations, updateDecorationSetWithWordWrappedDecorator } from './decorators';
19
20
  import { pluginKey } from './plugin-key';
20
- import { findCodeBlock, getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from './utils';
21
+ import { getAllChangedCodeBlocksInTransaction, getAllCodeBlockNodesInDoc } from './utils';
21
22
  export var createPlugin = function createPlugin(_ref) {
22
23
  var _ref$useLongPressSele = _ref.useLongPressSelection,
23
24
  useLongPressSelection = _ref$useLongPressSele === void 0 ? false : _ref$useLongPressSele,
@@ -1,4 +1,3 @@
1
- export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark } from '@atlaskit/editor-common/transforms';
2
1
  export function getCursor(selection) {
3
2
  return selection.$cursor || undefined;
4
3
  }
@@ -1,4 +1,3 @@
1
- export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, } from '@atlaskit/editor-common/transforms';
2
1
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
2
  import type { EditorState, ReadonlyTransaction, Selection } from '@atlaskit/editor-prosemirror/state';
4
3
  import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
@@ -1,4 +1,3 @@
1
- export { findCodeBlock, transformSliceToJoinAdjacentCodeBlocks, transformSingleLineCodeBlockToCodeMark, } from '@atlaskit/editor-common/transforms';
2
1
  import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
3
2
  import type { EditorState, ReadonlyTransaction, Selection } from '@atlaskit/editor-prosemirror/state';
4
3
  import type { NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "3.5.10",
3
+ "version": "3.5.12",
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": "^46.1.0",
35
35
  "@atlaskit/code": "^15.6.0",
36
- "@atlaskit/editor-common": "^95.11.0",
36
+ "@atlaskit/editor-common": "^97.0.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.2.1",
42
- "@atlaskit/icon": "^23.0.0",
42
+ "@atlaskit/icon": "^23.1.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"