@atlaskit/editor-common 74.29.1 → 74.29.2
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 +6 -0
- package/dist/cjs/card/MediaAndEmbedsToolbar/index.js +8 -8
- package/dist/cjs/core-utils/inside.js +2 -2
- package/dist/cjs/guideline/dynamicGuideline.js +4 -4
- package/dist/cjs/insert/index.js +30 -30
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/node-width/index.js +3 -3
- package/dist/cjs/safe-plugin/index.js +2 -2
- package/dist/cjs/selection/gap-cursor/selection.js +7 -7
- package/dist/cjs/transforms/expand.js +5 -5
- package/dist/cjs/transforms/extension.js +2 -2
- package/dist/cjs/transforms/layout.js +5 -5
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/UnsupportedInline/index.js +1 -1
- package/dist/cjs/utils/document.js +3 -3
- package/dist/cjs/utils/editor-core-utils.js +8 -8
- package/dist/cjs/utils/is-text-input.js +2 -2
- package/dist/cjs/utils/nodes.js +2 -2
- package/dist/cjs/utils/rich-media-utils.js +2 -2
- package/dist/cjs/utils/slice.js +6 -6
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/card/MediaAndEmbedsToolbar/index.js +2 -2
- package/dist/es2019/card/utils.js +0 -1
- package/dist/es2019/core-utils/inside.js +1 -1
- package/dist/es2019/guideline/dynamicGuideline.js +2 -2
- package/dist/es2019/insert/index.js +4 -4
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/node-width/index.js +1 -1
- package/dist/es2019/safe-plugin/index.js +1 -1
- package/dist/es2019/selection/gap-cursor/selection.js +2 -2
- package/dist/es2019/transforms/expand.js +2 -2
- package/dist/es2019/transforms/extension.js +1 -1
- package/dist/es2019/transforms/layout.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/UnsupportedInline/index.js +1 -1
- package/dist/es2019/utils/document.js +1 -1
- package/dist/es2019/utils/editor-core-utils.js +3 -3
- package/dist/es2019/utils/is-text-input.js +1 -1
- package/dist/es2019/utils/nodes.js +1 -1
- package/dist/es2019/utils/rich-media-utils.js +1 -1
- package/dist/es2019/utils/slice.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/card/MediaAndEmbedsToolbar/index.js +2 -2
- package/dist/esm/card/utils.js +0 -1
- package/dist/esm/core-utils/inside.js +1 -1
- package/dist/esm/guideline/dynamicGuideline.js +2 -2
- package/dist/esm/insert/index.js +4 -4
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/node-width/index.js +1 -1
- package/dist/esm/safe-plugin/index.js +1 -1
- package/dist/esm/selection/gap-cursor/selection.js +2 -2
- package/dist/esm/transforms/expand.js +2 -2
- package/dist/esm/transforms/extension.js +1 -1
- package/dist/esm/transforms/layout.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/UnsupportedInline/index.js +1 -1
- package/dist/esm/utils/document.js +1 -1
- package/dist/esm/utils/editor-core-utils.js +3 -3
- package/dist/esm/utils/is-text-input.js +1 -1
- package/dist/esm/utils/nodes.js +1 -1
- package/dist/esm/utils/rich-media-utils.js +1 -1
- package/dist/esm/utils/slice.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/api.d.ts +1 -1
- package/dist/types/analytics/types/events.d.ts +1 -1
- package/dist/types/analytics/utils.d.ts +1 -1
- package/dist/types/card/MediaAndEmbedsToolbar/index.d.ts +2 -2
- package/dist/types/card/types.d.ts +2 -2
- package/dist/types/card/utils.d.ts +2 -2
- package/dist/types/collab/index.d.ts +2 -2
- package/dist/types/core-utils/inside.d.ts +1 -1
- package/dist/types/editor-analytics/withAnalytics.d.ts +1 -1
- package/dist/types/event-dispatcher/index.d.ts +1 -1
- package/dist/types/guideline/dynamicGuideline.d.ts +1 -1
- package/dist/types/guideline/types.d.ts +1 -1
- package/dist/types/insert/index.d.ts +2 -2
- package/dist/types/link/LinkPicker/EditorLinkPicker/index.d.ts +1 -1
- package/dist/types/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types/link/LinkPicker/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types/link/types.d.ts +1 -1
- package/dist/types/node-width/index.d.ts +2 -2
- package/dist/types/preset/plugin-injection-api.d.ts +1 -1
- package/dist/types/provider-factory/macro-provider.d.ts +1 -1
- package/dist/types/provider-factory/quick-insert-provider.d.ts +2 -2
- package/dist/types/react-node-view/getInlineNodeViewProducer.d.ts +2 -2
- package/dist/types/react-node-view/index.d.ts +2 -2
- package/dist/types/react-node-view/types.d.ts +1 -1
- package/dist/types/safe-plugin/index.d.ts +1 -1
- package/dist/types/selection/gap-cursor/selection.d.ts +3 -3
- package/dist/types/selection/gap-cursor/utils/is-ignored.d.ts +1 -1
- package/dist/types/selection/gap-cursor/utils/is-valid-target-node.d.ts +1 -1
- package/dist/types/selection/types.d.ts +2 -2
- package/dist/types/selection/utils.d.ts +2 -2
- package/dist/types/selection-based-node-view/SelectionBasedNodeView.d.ts +2 -2
- package/dist/types/transforms/expand.d.ts +2 -2
- package/dist/types/transforms/extension.d.ts +1 -1
- package/dist/types/transforms/layout.d.ts +1 -1
- package/dist/types/types/annotation/index.d.ts +1 -1
- package/dist/types/types/command.d.ts +2 -2
- package/dist/types/types/context-panel.d.ts +1 -1
- package/dist/types/types/copy-button.d.ts +2 -2
- package/dist/types/types/editor-actions.d.ts +2 -2
- package/dist/types/types/editor-plugin.d.ts +1 -1
- package/dist/types/types/floating-toolbar.d.ts +3 -3
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/next-editor-plugin.d.ts +1 -1
- package/dist/types/types/plugin-factory.d.ts +1 -1
- package/dist/types/types/prosemirror-config.d.ts +2 -2
- package/dist/types/types/resizable-media-single.d.ts +1 -1
- package/dist/types/types/type-ahead.d.ts +2 -2
- package/dist/types/types/ui-components.d.ts +1 -1
- package/dist/types/ufo/experience-store.d.ts +1 -1
- package/dist/types/ui/MediaSingle/grid.d.ts +1 -1
- package/dist/types/ui/ResizerLegacy/types.d.ts +1 -1
- package/dist/types/ui/UnsupportedBlock/index.d.ts +1 -1
- package/dist/types/ui/UnsupportedInline/index.d.ts +1 -1
- package/dist/types/ui/unsupported-content-helper.d.ts +1 -1
- package/dist/types/ui-react/ReactEditorViewContext.d.ts +1 -1
- package/dist/types/utils/annotation/index.d.ts +1 -1
- package/dist/types/utils/compareNodes.d.ts +1 -1
- package/dist/types/utils/document.d.ts +2 -2
- package/dist/types/utils/editor-core-utils.d.ts +4 -4
- package/dist/types/utils/get-performance-options.d.ts +1 -1
- package/dist/types/utils/hyperlink.d.ts +2 -2
- package/dist/types/utils/is-text-input.d.ts +1 -1
- package/dist/types/utils/list.d.ts +1 -1
- package/dist/types/utils/macro.d.ts +1 -1
- package/dist/types/utils/nodes.d.ts +2 -2
- package/dist/types/utils/plugin-state-factory.d.ts +1 -1
- package/dist/types/utils/referentiality.d.ts +2 -2
- package/dist/types/utils/rich-media-utils.d.ts +1 -1
- package/dist/types/utils/slice.d.ts +1 -1
- package/dist/types/utils/table.d.ts +1 -1
- package/dist/types/utils/track-unsupported-content.d.ts +1 -1
- package/dist/types/utils/validate-using-spec.d.ts +1 -1
- package/dist/types/utils/validator.d.ts +1 -1
- package/dist/types/with-plugin-state/index.d.ts +2 -2
- package/dist/types/with-plugin-state/types.d.ts +1 -1
- package/dist/types-ts4.5/analytics/api.d.ts +1 -1
- package/dist/types-ts4.5/analytics/types/events.d.ts +1 -1
- package/dist/types-ts4.5/analytics/utils.d.ts +1 -1
- package/dist/types-ts4.5/card/MediaAndEmbedsToolbar/index.d.ts +2 -2
- package/dist/types-ts4.5/card/types.d.ts +2 -2
- package/dist/types-ts4.5/card/utils.d.ts +2 -2
- package/dist/types-ts4.5/collab/index.d.ts +2 -2
- package/dist/types-ts4.5/core-utils/inside.d.ts +1 -1
- package/dist/types-ts4.5/editor-analytics/withAnalytics.d.ts +1 -1
- package/dist/types-ts4.5/event-dispatcher/index.d.ts +1 -1
- package/dist/types-ts4.5/guideline/dynamicGuideline.d.ts +1 -1
- package/dist/types-ts4.5/guideline/types.d.ts +1 -1
- package/dist/types-ts4.5/insert/index.d.ts +2 -2
- package/dist/types-ts4.5/link/LinkPicker/EditorLinkPicker/index.d.ts +1 -1
- package/dist/types-ts4.5/link/LinkPicker/HyperlinkAddToolbar/HyperlinkAddToolbar.d.ts +1 -1
- package/dist/types-ts4.5/link/LinkPicker/HyperlinkAddToolbar/index.d.ts +1 -1
- package/dist/types-ts4.5/link/types.d.ts +1 -1
- package/dist/types-ts4.5/node-width/index.d.ts +2 -2
- package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +1 -1
- package/dist/types-ts4.5/provider-factory/macro-provider.d.ts +1 -1
- package/dist/types-ts4.5/provider-factory/quick-insert-provider.d.ts +2 -2
- package/dist/types-ts4.5/react-node-view/getInlineNodeViewProducer.d.ts +2 -2
- package/dist/types-ts4.5/react-node-view/index.d.ts +2 -2
- package/dist/types-ts4.5/react-node-view/types.d.ts +1 -1
- package/dist/types-ts4.5/safe-plugin/index.d.ts +1 -1
- package/dist/types-ts4.5/selection/gap-cursor/selection.d.ts +3 -3
- package/dist/types-ts4.5/selection/gap-cursor/utils/is-ignored.d.ts +1 -1
- package/dist/types-ts4.5/selection/gap-cursor/utils/is-valid-target-node.d.ts +1 -1
- package/dist/types-ts4.5/selection/types.d.ts +2 -2
- package/dist/types-ts4.5/selection/utils.d.ts +2 -2
- package/dist/types-ts4.5/selection-based-node-view/SelectionBasedNodeView.d.ts +2 -2
- package/dist/types-ts4.5/transforms/expand.d.ts +2 -2
- package/dist/types-ts4.5/transforms/extension.d.ts +1 -1
- package/dist/types-ts4.5/transforms/layout.d.ts +1 -1
- package/dist/types-ts4.5/types/annotation/index.d.ts +1 -1
- package/dist/types-ts4.5/types/command.d.ts +2 -2
- package/dist/types-ts4.5/types/context-panel.d.ts +1 -1
- package/dist/types-ts4.5/types/copy-button.d.ts +2 -2
- package/dist/types-ts4.5/types/editor-actions.d.ts +2 -2
- package/dist/types-ts4.5/types/editor-plugin.d.ts +1 -1
- package/dist/types-ts4.5/types/floating-toolbar.d.ts +3 -3
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/types/next-editor-plugin.d.ts +1 -1
- package/dist/types-ts4.5/types/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/types/prosemirror-config.d.ts +2 -2
- package/dist/types-ts4.5/types/resizable-media-single.d.ts +1 -1
- package/dist/types-ts4.5/types/type-ahead.d.ts +2 -2
- package/dist/types-ts4.5/types/ui-components.d.ts +1 -1
- package/dist/types-ts4.5/ufo/experience-store.d.ts +1 -1
- package/dist/types-ts4.5/ui/MediaSingle/grid.d.ts +1 -1
- package/dist/types-ts4.5/ui/ResizerLegacy/types.d.ts +1 -1
- package/dist/types-ts4.5/ui/UnsupportedBlock/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/UnsupportedInline/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/unsupported-content-helper.d.ts +1 -1
- package/dist/types-ts4.5/ui-react/ReactEditorViewContext.d.ts +1 -1
- package/dist/types-ts4.5/utils/annotation/index.d.ts +1 -1
- package/dist/types-ts4.5/utils/compareNodes.d.ts +1 -1
- package/dist/types-ts4.5/utils/document.d.ts +2 -2
- package/dist/types-ts4.5/utils/editor-core-utils.d.ts +4 -4
- package/dist/types-ts4.5/utils/get-performance-options.d.ts +1 -1
- package/dist/types-ts4.5/utils/hyperlink.d.ts +2 -2
- package/dist/types-ts4.5/utils/is-text-input.d.ts +1 -1
- package/dist/types-ts4.5/utils/list.d.ts +1 -1
- package/dist/types-ts4.5/utils/macro.d.ts +1 -1
- package/dist/types-ts4.5/utils/nodes.d.ts +2 -2
- package/dist/types-ts4.5/utils/plugin-state-factory.d.ts +1 -1
- package/dist/types-ts4.5/utils/referentiality.d.ts +2 -2
- package/dist/types-ts4.5/utils/rich-media-utils.d.ts +1 -1
- package/dist/types-ts4.5/utils/slice.d.ts +1 -1
- package/dist/types-ts4.5/utils/table.d.ts +1 -1
- package/dist/types-ts4.5/utils/track-unsupported-content.d.ts +1 -1
- package/dist/types-ts4.5/utils/validate-using-spec.d.ts +1 -1
- package/dist/types-ts4.5/utils/validator.d.ts +1 -1
- package/dist/types-ts4.5/with-plugin-state/index.d.ts +2 -2
- package/dist/types-ts4.5/with-plugin-state/types.d.ts +1 -1
- package/package.json +3 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 74.29.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4e6f1bf8511`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e6f1bf8511) - [ED-19233] Import prosemirror libraries from internal facade package
|
|
8
|
+
|
|
3
9
|
## 74.29.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
13
|
var _alignImageCenter = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-center"));
|
|
14
14
|
var _alignImageLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/align-image-left"));
|
|
@@ -20,7 +20,7 @@ var _mediaWrapRight = _interopRequireDefault(require("@atlaskit/icon/glyph/edito
|
|
|
20
20
|
var _analytics = require("../../analytics");
|
|
21
21
|
var _coreUtils = require("../../core-utils");
|
|
22
22
|
var _messages = _interopRequireWildcard(require("../../messages"));
|
|
23
|
-
var
|
|
23
|
+
var _utils2 = require("../../utils");
|
|
24
24
|
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); }
|
|
25
25
|
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; }
|
|
26
26
|
// Workaround as we don't want to import this package into `editor-common`
|
|
@@ -84,16 +84,16 @@ var makeAlign = function makeAlign(layout, nodeType, widthPluginDependencyApi, a
|
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
86
|
var nodeWidth = getNodeWidth(node, state.schema);
|
|
87
|
-
var newAttrs = (0,
|
|
87
|
+
var newAttrs = (0, _utils2.alignAttributes)(layout, node.attrs, undefined, nodeWidth, widthPluginState.lineLength);
|
|
88
88
|
var tr = state.tr.setNodeMarkup(state.selection.from, undefined, newAttrs);
|
|
89
89
|
tr.setMeta('scrollIntoView', false);
|
|
90
90
|
// when image captions are enabled, the wrong node gets selected after
|
|
91
91
|
// setNodeMarkup is called
|
|
92
|
-
tr.setSelection(
|
|
92
|
+
tr.setSelection(_state.NodeSelection.create(tr.doc, state.selection.from));
|
|
93
93
|
var paragraph = tr.doc.type.schema.nodes.paragraph;
|
|
94
94
|
|
|
95
95
|
// see https://product-fabric.atlassian.net/browse/ED-15518 insert a new paragraph when an embedded card is wrapped left or right
|
|
96
|
-
if (layout.startsWith('wrap') && paragraph && !tr.doc.nodeAt(state.selection.to) && ((0, _coreUtils.insideTable)(state) || (0,
|
|
96
|
+
if (layout.startsWith('wrap') && paragraph && !tr.doc.nodeAt(state.selection.to) && ((0, _coreUtils.insideTable)(state) || (0, _utils2.isInLayoutColumn)(state))) {
|
|
97
97
|
var emptyParaghraph = paragraph.createAndFill();
|
|
98
98
|
if (emptyParaghraph) {
|
|
99
99
|
tr.insert(state.selection.to, emptyParaghraph);
|
|
@@ -129,13 +129,13 @@ var mapIconsToToolbarItem = function mapIconsToToolbarItem(icons, layout, intl,
|
|
|
129
129
|
};
|
|
130
130
|
var shouldHideLayoutToolbar = function shouldHideLayoutToolbar(selection, _ref2, allowResizingInTables) {
|
|
131
131
|
var nodes = _ref2.nodes;
|
|
132
|
-
return (0,
|
|
132
|
+
return (0, _utils.hasParentNodeOfType)([nodes.bodiedExtension, nodes.listItem, nodes.expand, nodes.nestedExpand].concat((0, _toConsumableArray2.default)(allowResizingInTables ? [] : [nodes.table])).filter(Boolean))(selection);
|
|
133
133
|
};
|
|
134
134
|
var buildLayoutButtons = function buildLayoutButtons(state, intl, nodeType, widthPluginDependencyApi, analyticsApi, allowResizing, allowResizingInTables) {
|
|
135
135
|
var allowWrapping = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
|
|
136
136
|
var allowAlignment = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
137
137
|
var selection = state.selection;
|
|
138
|
-
if (!(selection instanceof
|
|
138
|
+
if (!(selection instanceof _state.NodeSelection) || !selection.node || !nodeType || shouldHideLayoutToolbar(selection, state.schema, allowResizingInTables)) {
|
|
139
139
|
return [];
|
|
140
140
|
}
|
|
141
141
|
var layout = selection.node.attrs.layout;
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.insideTable = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
8
|
var insideTable = function insideTable(state) {
|
|
9
9
|
var _state$schema$nodes = state.schema.nodes,
|
|
10
10
|
table = _state$schema$nodes.table,
|
|
11
11
|
tableCell = _state$schema$nodes.tableCell;
|
|
12
|
-
return (0,
|
|
12
|
+
return (0, _utils.hasParentNodeOfType)([table, tableCell])(state.selection);
|
|
13
13
|
};
|
|
14
14
|
exports.insideTable = insideTable;
|
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.generateDynamicGuidelines = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
11
|
var _mediaSingle = require("../media-single");
|
|
12
12
|
var _constants = require("./constants");
|
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
15
|
var generateDynamicGuidelines = function generateDynamicGuidelines(state, editorWidth) {
|
|
16
|
-
var selectedNode = state.selection instanceof
|
|
17
|
-
var mediaSingleNode = (0,
|
|
16
|
+
var selectedNode = state.selection instanceof _state.NodeSelection && state.selection.node;
|
|
17
|
+
var mediaSingleNode = (0, _utils.findChildren)(state.tr.doc, function (node) {
|
|
18
18
|
return node.type === state.schema.nodes.mediaSingle;
|
|
19
19
|
}, false // only top level
|
|
20
20
|
);
|
package/dist/cjs/insert/index.js
CHANGED
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.shouldSplitSelectedNodeOnNodeInsertion = exports.safeInsert = exports.normaliseNestedLayout = exports.insertSelectedItem = exports.LookDirection = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
9
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
10
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
12
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
13
13
|
var _selection = require("../selection");
|
|
14
|
-
var
|
|
14
|
+
var _utils2 = require("../utils");
|
|
15
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
17
|
var LookDirection = /*#__PURE__*/function (LookDirection) {
|
|
@@ -49,19 +49,19 @@ var isFirstChild = function isFirstChild($pos, doc) {
|
|
|
49
49
|
};
|
|
50
50
|
var nodeIsInsideAList = function nodeIsInsideAList(tr) {
|
|
51
51
|
var nodes = tr.doc.type.schema.nodes;
|
|
52
|
-
return (0,
|
|
52
|
+
return (0, _utils.hasParentNodeOfType)([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
53
53
|
};
|
|
54
54
|
var selectionIsInsideAPanel = function selectionIsInsideAPanel(tr) {
|
|
55
55
|
var nodes = tr.doc.type.schema.nodes;
|
|
56
|
-
return (0,
|
|
56
|
+
return (0, _utils.hasParentNodeOfType)(nodes.panel)(tr.selection);
|
|
57
57
|
};
|
|
58
58
|
var selectionIsInNestedList = function selectionIsInNestedList(tr) {
|
|
59
59
|
var nodes = tr.doc.type.schema.nodes;
|
|
60
|
-
var parentListNode = (0,
|
|
60
|
+
var parentListNode = (0, _utils.findParentNodeOfType)([nodes.orderedList, nodes.bulletList])(tr.selection);
|
|
61
61
|
if (!parentListNode) {
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
|
-
return (0,
|
|
64
|
+
return (0, _utils2.isListItemNode)(tr.doc.resolve(parentListNode.pos).parent);
|
|
65
65
|
};
|
|
66
66
|
var insertBeforeOrAfter = function insertBeforeOrAfter(tr, lookDirection, $parentPos, $proposedPosition, content) {
|
|
67
67
|
/**
|
|
@@ -90,24 +90,24 @@ var safeInsert = function safeInsert(content, position) {
|
|
|
90
90
|
var _tr$selection$$from$n;
|
|
91
91
|
var nodes = tr.doc.type.schema.nodes;
|
|
92
92
|
var whitelist = [nodes.rule, nodes.mediaSingle];
|
|
93
|
-
if (content instanceof
|
|
93
|
+
if (content instanceof _model.Fragment || !whitelist.includes(content.type)) {
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// Check for selection
|
|
98
|
-
if (!tr.selection.empty || (0,
|
|
98
|
+
if (!tr.selection.empty || (0, _utils.isNodeSelection)(tr.selection)) {
|
|
99
99
|
// NOT IMPLEMENTED
|
|
100
100
|
return null;
|
|
101
101
|
}
|
|
102
102
|
var $from = tr.selection.$from;
|
|
103
|
-
var $insertPos = position ? tr.doc.resolve(position) : (0,
|
|
103
|
+
var $insertPos = position ? tr.doc.resolve(position) : (0, _utils.isNodeSelection)(tr.selection) ? tr.doc.resolve($from.pos + 1) : $from;
|
|
104
104
|
var lookDirection;
|
|
105
105
|
var insertPosEnd = $insertPos.end();
|
|
106
106
|
var insertPosStart = $insertPos.start();
|
|
107
107
|
|
|
108
108
|
// When parent node is an empty paragraph,
|
|
109
109
|
// check the empty paragraph is the first or last node of its parent.
|
|
110
|
-
if ((0,
|
|
110
|
+
if ((0, _utils2.isEmptyParagraph)($insertPos.parent)) {
|
|
111
111
|
if (isLastChild($insertPos, tr.doc)) {
|
|
112
112
|
lookDirection = LookDirection.After;
|
|
113
113
|
} else if (isFirstChild($insertPos, tr.doc)) {
|
|
@@ -133,7 +133,7 @@ var safeInsert = function safeInsert(content, position) {
|
|
|
133
133
|
var nonRuleNodeInListNode = !(content.type === nodes.rule) && nodeIsInsideAList(tr);
|
|
134
134
|
if (ruleNodeInANestedListNode || noDirectionAndShouldNotSplit && nonRuleNodeInListNode || noDirectionAndShouldNotSplit && !nodeIsInsideAList(tr)) {
|
|
135
135
|
// node to be inserted is an invalid child of selection so insert below selected node
|
|
136
|
-
return (0,
|
|
136
|
+
return (0, _utils.safeInsert)(content, tr.selection.from)(tr);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
// if node is a rule and that is a flat list splitting and not at the end of a list
|
|
@@ -142,7 +142,7 @@ var safeInsert = function safeInsert(content, position) {
|
|
|
142
142
|
to = _tr$selection.to;
|
|
143
143
|
var ruleTypeInAList = content.type === nodes.rule && nodeIsInsideAList(tr);
|
|
144
144
|
if (ruleTypeInAList && !($insertPos.pos === insertPosEnd)) {
|
|
145
|
-
return tr.replaceRange(from, to, new
|
|
145
|
+
return tr.replaceRange(from, to, new _model.Slice(_model.Fragment.from(nodes.rule.createChecked()), 0, 0));
|
|
146
146
|
}
|
|
147
147
|
if (!lookDirection) {
|
|
148
148
|
// fallback to consumer for now
|
|
@@ -150,7 +150,7 @@ var safeInsert = function safeInsert(content, position) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// Replace empty paragraph
|
|
153
|
-
if ((0,
|
|
153
|
+
if ((0, _utils2.isEmptyParagraph)($insertPos.parent) && (0, _utils.canInsert)(tr.doc.resolve($insertPos[lookDirection]()), content)) {
|
|
154
154
|
return finaliseInsert(tr.replaceWith($insertPos.before(), $insertPos.after(), content), -1);
|
|
155
155
|
}
|
|
156
156
|
var $proposedPosition = $insertPos;
|
|
@@ -159,7 +159,7 @@ var safeInsert = function safeInsert(content, position) {
|
|
|
159
159
|
var parentNode = $parentPos.node();
|
|
160
160
|
|
|
161
161
|
// Insert at position (before or after target pos)
|
|
162
|
-
if ((0,
|
|
162
|
+
if ((0, _utils.canInsert)($proposedPosition, content)) {
|
|
163
163
|
return finaliseInsert(tr.insert($proposedPosition.pos, content), content.nodeSize);
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -169,7 +169,7 @@ var safeInsert = function safeInsert(content, position) {
|
|
|
169
169
|
|
|
170
170
|
// Move selection to the closest text node, otherwise it defaults to the whatever the lookDirection is set to above
|
|
171
171
|
if ([nodes.orderedList, nodes.bulletList].includes(parentNode.type) && nextTr) {
|
|
172
|
-
return nextTr.setSelection(
|
|
172
|
+
return nextTr.setSelection(_state.TextSelection.between(nextTr.selection.$from, nextTr.selection.$from));
|
|
173
173
|
} else {
|
|
174
174
|
return nextTr;
|
|
175
175
|
}
|
|
@@ -184,7 +184,7 @@ var safeInsert = function safeInsert(content, position) {
|
|
|
184
184
|
exports.safeInsert = safeInsert;
|
|
185
185
|
var finaliseInsert = function finaliseInsert(tr, nodeLength) {
|
|
186
186
|
var lastStep = tr.steps[tr.steps.length - 1];
|
|
187
|
-
if (!(lastStep instanceof
|
|
187
|
+
if (!(lastStep instanceof _transform.ReplaceStep || lastStep instanceof _transform.ReplaceAroundStep)) {
|
|
188
188
|
return null;
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -202,16 +202,16 @@ var insertSelectedItem = function insertSelectedItem(maybeNode) {
|
|
|
202
202
|
if (!maybeNode) {
|
|
203
203
|
return tr;
|
|
204
204
|
}
|
|
205
|
-
var isInputFragment = maybeNode instanceof
|
|
205
|
+
var isInputFragment = maybeNode instanceof _model.Fragment;
|
|
206
206
|
var node;
|
|
207
207
|
try {
|
|
208
|
-
node = maybeNode instanceof
|
|
208
|
+
node = maybeNode instanceof _model.Node || isInputFragment ? maybeNode : typeof maybeNode === 'string' ? state.schema.text(maybeNode) : _model.Node.fromJSON(state.schema, maybeNode);
|
|
209
209
|
} catch (e) {
|
|
210
210
|
// eslint-disable-next-line no-console
|
|
211
211
|
console.error(e);
|
|
212
212
|
return tr;
|
|
213
213
|
}
|
|
214
|
-
if (node instanceof
|
|
214
|
+
if (node instanceof _model.Node && node.isText) {
|
|
215
215
|
tr = tr.replaceWith(start, start, node);
|
|
216
216
|
|
|
217
217
|
/**
|
|
@@ -219,7 +219,7 @@ var insertSelectedItem = function insertSelectedItem(maybeNode) {
|
|
|
219
219
|
* Replacing a type ahead query mark with a block node.
|
|
220
220
|
*
|
|
221
221
|
*/
|
|
222
|
-
} else if (node instanceof
|
|
222
|
+
} else if (node instanceof _model.Node && node.isBlock) {
|
|
223
223
|
/**
|
|
224
224
|
*
|
|
225
225
|
* Rule has unique insertion behaviour
|
|
@@ -233,11 +233,11 @@ var insertSelectedItem = function insertSelectedItem(maybeNode) {
|
|
|
233
233
|
// ED-17438 If the selection is not an empty paragraph we want to use pmSafeInsert
|
|
234
234
|
// This fixes a bug where if a rule was inserted using safeInsert and the selection
|
|
235
235
|
// was an empty paragraph it would not be inserted
|
|
236
|
-
!(0,
|
|
236
|
+
!(0, _utils2.isEmptyParagraph)(tr.selection.$from.parent)) {
|
|
237
237
|
var _safeInsert;
|
|
238
238
|
tr = (_safeInsert = safeInsert(node, tr.selection.from)(tr)) !== null && _safeInsert !== void 0 ? _safeInsert : tr;
|
|
239
239
|
} else {
|
|
240
|
-
tr = (0,
|
|
240
|
+
tr = (0, _utils.safeInsert)(normaliseNestedLayout(state, node), undefined, true)(tr);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
/**
|
|
@@ -245,15 +245,15 @@ var insertSelectedItem = function insertSelectedItem(maybeNode) {
|
|
|
245
245
|
* Replacing a type ahead query mark with an inline node.
|
|
246
246
|
*
|
|
247
247
|
*/
|
|
248
|
-
} else if (node instanceof
|
|
249
|
-
var fragment = isInputFragment ? node :
|
|
248
|
+
} else if (node instanceof _model.Node && node.isInline || isInputFragment) {
|
|
249
|
+
var fragment = isInputFragment ? node : _model.Fragment.fromArray([node, state.schema.text(' ')]);
|
|
250
250
|
tr = tr.replaceWith(start, start, fragment);
|
|
251
251
|
if (opts.selectInlineNode) {
|
|
252
252
|
// Select inserted node
|
|
253
|
-
tr = tr.setSelection(
|
|
253
|
+
tr = tr.setSelection(_state.NodeSelection.create(tr.doc, start));
|
|
254
254
|
} else {
|
|
255
255
|
// Placing cursor after node + space.
|
|
256
|
-
tr = tr.setSelection(
|
|
256
|
+
tr = tr.setSelection(_state.Selection.near(tr.doc.resolve(start + fragment.size)));
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
return tr;
|
|
@@ -270,7 +270,7 @@ var shouldSplitSelectedNodeOnNodeInsertion = function shouldSplitSelectedNodeOnN
|
|
|
270
270
|
var parentNodeType = _ref2.parentNodeType,
|
|
271
271
|
grandParentNodeType = _ref2.grandParentNodeType,
|
|
272
272
|
content = _ref2.content;
|
|
273
|
-
if (parentNodeType.name === 'doc' || parentNodeType.name === 'paragraph' && grandParentNodeType.validContent(
|
|
273
|
+
if (parentNodeType.name === 'doc' || parentNodeType.name === 'paragraph' && grandParentNodeType.validContent(_model.Fragment.from(content))) {
|
|
274
274
|
return true;
|
|
275
275
|
}
|
|
276
276
|
return false;
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
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; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "74.29.
|
|
19
|
+
var packageVersion = "74.29.2";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.layoutToWidth = exports.getTableContainerWidth = exports.getParentNodeWidth = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
8
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
9
9
|
var _constants = require("@atlaskit/theme/constants");
|
|
10
10
|
var _extension = require("../styles/shared/extension");
|
|
@@ -58,7 +58,7 @@ var getParentNodeWidth = function getParentNodeWidth(pos, state, containerWidth,
|
|
|
58
58
|
if (containerWidth.width > _editorSharedStyles.gridMediumMaxWidth || ((_contextPanelPluginKe = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe === void 0 ? void 0 : _contextPanelPluginKe.contents.length) > 0 && ((_contextPanelPluginKe2 = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe2 === void 0 ? void 0 : _contextPanelPluginKe2.contents[0]) !== undefined) {
|
|
59
59
|
parentWidth -= (_layout.LAYOUT_SECTION_MARGIN + 2) * (node.childCount - 1); // margin between sections
|
|
60
60
|
var $pos = state.doc.resolve(pos);
|
|
61
|
-
var column = (0,
|
|
61
|
+
var column = (0, _utils.findParentNodeOfTypeClosestToPos)($pos, [state.schema.nodes.layoutColumn]);
|
|
62
62
|
if (column && column.node && !isNaN(column.node.attrs.width)) {
|
|
63
63
|
// get exact width of parent layout column using node attrs
|
|
64
64
|
parentWidth = Math.round(parentWidth * column.node.attrs.width * 0.01);
|
|
@@ -98,7 +98,7 @@ var getNestedParentNode = function getNestedParentNode(tablePos, state) {
|
|
|
98
98
|
return null;
|
|
99
99
|
}
|
|
100
100
|
var $pos = state.doc.resolve(tablePos);
|
|
101
|
-
var parent = (0,
|
|
101
|
+
var parent = (0, _utils.findParentNodeOfTypeClosestToPos)($pos, [state.schema.nodes.bodiedExtension, state.schema.nodes.layoutSection, state.schema.nodes.expand]);
|
|
102
102
|
return parent ? parent.node : null;
|
|
103
103
|
};
|
|
104
104
|
var calcBreakoutNodeWidth = function calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled) {
|
|
@@ -10,7 +10,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
10
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var
|
|
13
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
15
15
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
16
|
var SafePlugin = /*#__PURE__*/function (_Plugin) {
|
|
@@ -25,5 +25,5 @@ var SafePlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
25
25
|
return _super.call(this, spec);
|
|
26
26
|
}
|
|
27
27
|
return (0, _createClass2.default)(SafePlugin);
|
|
28
|
-
}(
|
|
28
|
+
}(_state.Plugin);
|
|
29
29
|
exports.SafePlugin = SafePlugin;
|
|
@@ -12,8 +12,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
12
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
16
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _isValidTargetNode = require("./utils/is-valid-target-node");
|
|
18
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
19
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
@@ -46,7 +46,7 @@ var GapCursorSelection = /*#__PURE__*/function (_Selection) {
|
|
|
46
46
|
key: "map",
|
|
47
47
|
value: function map(doc, mapping) {
|
|
48
48
|
var $pos = doc.resolve(mapping.map(this.head));
|
|
49
|
-
return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos, this.side) :
|
|
49
|
+
return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos, this.side) : _state.Selection.near($pos);
|
|
50
50
|
}
|
|
51
51
|
}, {
|
|
52
52
|
key: "eq",
|
|
@@ -56,7 +56,7 @@ var GapCursorSelection = /*#__PURE__*/function (_Selection) {
|
|
|
56
56
|
}, {
|
|
57
57
|
key: "content",
|
|
58
58
|
value: function content() {
|
|
59
|
-
return
|
|
59
|
+
return _model.Slice.empty;
|
|
60
60
|
}
|
|
61
61
|
}, {
|
|
62
62
|
key: "getBookmark",
|
|
@@ -135,9 +135,9 @@ var GapCursorSelection = /*#__PURE__*/function (_Selection) {
|
|
|
135
135
|
}
|
|
136
136
|
}]);
|
|
137
137
|
return GapCursorSelection;
|
|
138
|
-
}(
|
|
138
|
+
}(_state.Selection);
|
|
139
139
|
exports.GapCursorSelection = GapCursorSelection;
|
|
140
|
-
|
|
140
|
+
_state.Selection.jsonID(JSON_ID, GapCursorSelection);
|
|
141
141
|
var GapBookmark = /*#__PURE__*/function () {
|
|
142
142
|
function GapBookmark(pos) {
|
|
143
143
|
(0, _classCallCheck2.default)(this, GapBookmark);
|
|
@@ -152,7 +152,7 @@ var GapBookmark = /*#__PURE__*/function () {
|
|
|
152
152
|
key: "resolve",
|
|
153
153
|
value: function resolve(doc) {
|
|
154
154
|
var $pos = doc.resolve(this.pos);
|
|
155
|
-
return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos) :
|
|
155
|
+
return GapCursorSelection.valid($pos) ? new GapCursorSelection($pos) : _state.Selection.near($pos);
|
|
156
156
|
}
|
|
157
157
|
}]);
|
|
158
158
|
return GapBookmark;
|
|
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.transformSliceToRemoveOpenExpand = exports.transformSliceNestedExpandToExpand = exports.findExpand = void 0;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
9
9
|
var _slice = require("../utils/slice");
|
|
10
10
|
var findExpand = function findExpand(state, selection) {
|
|
11
11
|
var _state$schema$nodes = state.schema.nodes,
|
|
12
12
|
expand = _state$schema$nodes.expand,
|
|
13
13
|
nestedExpand = _state$schema$nodes.nestedExpand;
|
|
14
|
-
return (0,
|
|
14
|
+
return (0, _utils.findSelectedNodeOfType)([expand, nestedExpand])(selection || state.selection) || (0, _utils.findParentNodeOfType)([expand, nestedExpand])(selection || state.selection);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// If the top level is a single expand, and the expand is not
|
|
@@ -21,7 +21,7 @@ var findExpand = function findExpand(state, selection) {
|
|
|
21
21
|
exports.findExpand = findExpand;
|
|
22
22
|
var transformSliceToRemoveOpenExpand = function transformSliceToRemoveOpenExpand(slice, schema) {
|
|
23
23
|
if (slice.openStart > 1 && slice.openEnd > 1 && slice.content.childCount === 1 && slice.content.firstChild && slice.content.firstChild.type === schema.nodes.expand) {
|
|
24
|
-
return new
|
|
24
|
+
return new _model.Slice(slice.content.firstChild.content, slice.openStart - 1, slice.openEnd - 1);
|
|
25
25
|
}
|
|
26
26
|
return slice;
|
|
27
27
|
};
|
|
@@ -38,6 +38,6 @@ var transformSliceNestedExpandToExpand = function transformSliceNestedExpandToEx
|
|
|
38
38
|
children.push(node);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
return new
|
|
41
|
+
return new _model.Slice(_model.Fragment.fromArray(children), slice.openStart, slice.openEnd);
|
|
42
42
|
};
|
|
43
43
|
exports.transformSliceNestedExpandToExpand = transformSliceNestedExpandToExpand;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.transformSliceToRemoveOpenBodiedExtension = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
8
|
var _slice = require("../utils/slice");
|
|
9
9
|
/**
|
|
10
10
|
* Lift content out of "open" top-level bodiedExtensions.
|
|
@@ -24,6 +24,6 @@ var transformSliceToRemoveOpenBodiedExtension = function transformSliceToRemoveO
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
// If the first/last child has changed - then we know we've removed a bodied extension & to decrement the open depth
|
|
27
|
-
return new
|
|
27
|
+
return new _model.Slice(fragment, fragment.firstChild && fragment.firstChild.type !== slice.content.firstChild.type ? slice.openStart - 1 : slice.openStart, fragment.lastChild && fragment.lastChild.type !== slice.content.lastChild.type ? slice.openEnd - 1 : slice.openEnd);
|
|
28
28
|
};
|
|
29
29
|
exports.transformSliceToRemoveOpenBodiedExtension = transformSliceToRemoveOpenBodiedExtension;
|
|
@@ -7,13 +7,13 @@ exports.removeLayoutFromFirstChild = removeLayoutFromFirstChild;
|
|
|
7
7
|
exports.removeLayoutFromLastChild = removeLayoutFromLastChild;
|
|
8
8
|
exports.transformSliceToRemoveOpenLayoutNodes = transformSliceToRemoveOpenLayoutNodes;
|
|
9
9
|
exports.unwrapContentFromLayout = unwrapContentFromLayout;
|
|
10
|
-
var
|
|
10
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
11
|
var _slice = require("../utils/slice");
|
|
12
12
|
var isLayoutNode = function isLayoutNode(node) {
|
|
13
13
|
return node.type === node.type.schema.nodes.layoutSection || node.type === node.type.schema.nodes.layoutColumn;
|
|
14
14
|
};
|
|
15
15
|
function unwrapContentFromLayout(maybeLayoutSection) {
|
|
16
|
-
var fragment = (0, _slice.mapFragment)(
|
|
16
|
+
var fragment = (0, _slice.mapFragment)(_model.Fragment.from(maybeLayoutSection), function (node) {
|
|
17
17
|
return isLayoutNode(node) ? node.content : node;
|
|
18
18
|
});
|
|
19
19
|
var nodes = [];
|
|
@@ -44,7 +44,7 @@ function transformSliceToRemoveOpenLayoutNodes(slice, schema) {
|
|
|
44
44
|
if (slice.openStart && slice.openEnd && slice.content.childCount === 1) {
|
|
45
45
|
var maybeLayoutSection = slice.content.firstChild;
|
|
46
46
|
if (maybeLayoutSection.type === schema.nodes.layoutSection) {
|
|
47
|
-
return new
|
|
47
|
+
return new _model.Slice((0, _slice.flatmap)(slice.content, removeLayoutFromFirstChild),
|
|
48
48
|
// '-2' here because we've removed the layoutSection/layoutColumn; reducing the open depth.
|
|
49
49
|
slice.openStart - 2, slice.openEnd - 2);
|
|
50
50
|
}
|
|
@@ -52,12 +52,12 @@ function transformSliceToRemoveOpenLayoutNodes(slice, schema) {
|
|
|
52
52
|
|
|
53
53
|
// Case 2: A slice starting inside a layoutSection and finishing outside
|
|
54
54
|
if (slice.openStart && slice.content.firstChild.type === schema.nodes.layoutSection) {
|
|
55
|
-
slice = new
|
|
55
|
+
slice = new _model.Slice((0, _slice.flatmap)(slice.content, removeLayoutFromFirstChild), slice.openStart - 2, slice.openEnd);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// Case 3: A slice starting outside a layoutSection and finishing inside
|
|
59
59
|
if (slice.openEnd && slice.content.lastChild.type === schema.nodes.layoutSection) {
|
|
60
|
-
slice = new
|
|
60
|
+
slice = new _model.Slice((0, _slice.flatmap)(slice.content, removeLayoutFromLastChild), slice.openStart, slice.openEnd - 2);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// Case 2 & 3 also handles a slice starting in one layoutSection & finishing in a different layoutSection
|
|
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
|
|
|
24
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
25
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "74.29.
|
|
27
|
+
var packageVersion = "74.29.2";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -23,7 +23,7 @@ var _templateObject;
|
|
|
23
23
|
/** @jsx jsx */
|
|
24
24
|
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); }
|
|
25
25
|
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; }
|
|
26
|
-
var inlineNodeStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n background: ", ";\n border: 1px dashed ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n cursor: default;\n display: inline-flex;\n font-size: ", ";\n margin: 0
|
|
26
|
+
var inlineNodeStyle = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n align-items: center;\n background: ", ";\n border: 1px dashed ", ";\n border-radius: ", "px;\n box-sizing: border-box;\n cursor: default;\n display: inline-flex;\n font-size: ", ";\n margin: 0 ", ";\n min-height: 24px;\n padding: 0 10px;\n vertical-align: middle;\n white-space: nowrap;\n"])), "var(--ds-background-disabled, ".concat(_colors.N30, ")"), "var(--ds-border-disabled, ".concat(_colors.N50, ")"), (0, _constants.borderRadius)(), (0, _editorSharedStyles.relativeFontSizeToBase16)((0, _constants.fontSize)()), "var(--ds-space-025, 2px)");
|
|
27
27
|
var UnsupportedInlineNode = function UnsupportedInlineNode(_ref) {
|
|
28
28
|
var node = _ref.node,
|
|
29
29
|
intl = _ref.intl,
|
|
@@ -9,8 +9,8 @@ exports.hasDocAsParent = hasDocAsParent;
|
|
|
9
9
|
exports.isEmptyDocument = isEmptyDocument;
|
|
10
10
|
exports.nodesBetweenChanged = nodesBetweenChanged;
|
|
11
11
|
exports.processRawValue = processRawValue;
|
|
12
|
-
var _prosemirrorModel = require("prosemirror-model");
|
|
13
12
|
var _transforms = require("@atlaskit/adf-utils/transforms");
|
|
13
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
14
|
var _analytics = require("../analytics");
|
|
15
15
|
var _editorCoreUtils = require("./editor-core-utils");
|
|
16
16
|
var _privacyFilter = require("./filter/privacy-filter");
|
|
@@ -118,7 +118,7 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
if (contentTransformer) {
|
|
121
|
-
return
|
|
121
|
+
return _model.Node.fromJSON(schema, node);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// link mark on mediaSingle is deprecated, need to move link mark to child media node
|
|
@@ -205,7 +205,7 @@ function processRawValue(schema, value, providerFactory, sanitizePrivateContent,
|
|
|
205
205
|
}
|
|
206
206
|
var entity = (0, _validateUsingSpec.validateADFEntity)(schema, transformedAdf || node, dispatchAnalyticsEvent);
|
|
207
207
|
var newEntity = maySanitizePrivateContent(entity, providerFactory, sanitizePrivateContent);
|
|
208
|
-
var parsedDoc =
|
|
208
|
+
var parsedDoc = _model.Node.fromJSON(schema, newEntity);
|
|
209
209
|
|
|
210
210
|
// throws an error if the document is invalid
|
|
211
211
|
try {
|
|
@@ -11,9 +11,9 @@ exports.setNodeSelection = void 0;
|
|
|
11
11
|
exports.setTextSelection = setTextSelection;
|
|
12
12
|
exports.stepAddsOneOf = stepAddsOneOf;
|
|
13
13
|
exports.stepHasSlice = void 0;
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
14
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
15
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
16
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
17
17
|
var _dom = require("./dom");
|
|
18
18
|
/**
|
|
19
19
|
* Checks if node is an empty paragraph.
|
|
@@ -46,7 +46,7 @@ function stepAddsOneOf(step, nodeTypes) {
|
|
|
46
46
|
return adds;
|
|
47
47
|
}
|
|
48
48
|
var extractSliceFromStep = function extractSliceFromStep(step) {
|
|
49
|
-
if (!(step instanceof
|
|
49
|
+
if (!(step instanceof _transform.ReplaceStep) && !(step instanceof _transform.ReplaceAroundStep)) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -57,7 +57,7 @@ var extractSliceFromStep = function extractSliceFromStep(step) {
|
|
|
57
57
|
};
|
|
58
58
|
exports.extractSliceFromStep = extractSliceFromStep;
|
|
59
59
|
var isTextSelection = function isTextSelection(selection) {
|
|
60
|
-
return selection instanceof
|
|
60
|
+
return selection instanceof _state.TextSelection;
|
|
61
61
|
};
|
|
62
62
|
exports.isTextSelection = isTextSelection;
|
|
63
63
|
var isElementInTableCell = function isElementInTableCell(element) {
|
|
@@ -75,14 +75,14 @@ var setNodeSelection = function setNodeSelection(view, pos) {
|
|
|
75
75
|
if (!isFinite(pos)) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
var tr = state.tr.setSelection(
|
|
78
|
+
var tr = state.tr.setSelection(_state.NodeSelection.create(state.doc, pos));
|
|
79
79
|
dispatch(tr);
|
|
80
80
|
};
|
|
81
81
|
exports.setNodeSelection = setNodeSelection;
|
|
82
82
|
function setTextSelection(view, anchor, head) {
|
|
83
83
|
var state = view.state,
|
|
84
84
|
dispatch = view.dispatch;
|
|
85
|
-
var tr = state.tr.setSelection(
|
|
85
|
+
var tr = state.tr.setSelection(_state.TextSelection.create(state.doc, anchor, head));
|
|
86
86
|
dispatch(tr);
|
|
87
87
|
}
|
|
88
88
|
function nonNullable(value) {
|
|
@@ -101,6 +101,6 @@ var isValidPosition = function isValidPosition(pos, state) {
|
|
|
101
101
|
};
|
|
102
102
|
exports.isValidPosition = isValidPosition;
|
|
103
103
|
var isInLayoutColumn = function isInLayoutColumn(state) {
|
|
104
|
-
return (0,
|
|
104
|
+
return (0, _utils.hasParentNodeOfType)(state.schema.nodes.layoutSection)(state.selection);
|
|
105
105
|
};
|
|
106
106
|
exports.isInLayoutColumn = isInLayoutColumn;
|