@atlaskit/adf-schema 26.3.0 → 26.4.1
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 +12 -0
- package/dist/cjs/schema/create-schema.js +2 -2
- package/dist/cjs/schema/nodes/code-block.js +2 -2
- package/dist/cjs/steps/analytics.js +8 -8
- package/dist/cjs/steps/link-meta-step.js +7 -7
- package/dist/cjs/steps/override-document-step.js +94 -0
- package/dist/cjs/steps/set-attrs.js +9 -9
- package/dist/cjs/steps/table/add-column.js +10 -10
- package/dist/cjs/steps/table/sort-column.js +7 -7
- package/dist/cjs/steps/table/utils/side-effects/table.js +3 -3
- package/dist/cjs/steps/type-ahead.js +7 -7
- package/dist/cjs/steps.js +8 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/schema/create-schema.js +1 -1
- package/dist/es2019/schema/nodes/code-block.js +1 -1
- package/dist/es2019/steps/analytics.js +2 -2
- package/dist/es2019/steps/link-meta-step.js +2 -2
- package/dist/es2019/steps/override-document-step.js +60 -0
- package/dist/es2019/steps/set-attrs.js +2 -2
- package/dist/es2019/steps/table/add-column.js +1 -1
- package/dist/es2019/steps/table/sort-column.js +2 -2
- package/dist/es2019/steps/table/utils/side-effects/table.js +1 -1
- package/dist/es2019/steps/type-ahead.js +2 -2
- package/dist/es2019/steps.js +2 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/schema/create-schema.js +1 -1
- package/dist/esm/schema/nodes/code-block.js +1 -1
- package/dist/esm/steps/analytics.js +2 -2
- package/dist/esm/steps/link-meta-step.js +2 -2
- package/dist/esm/steps/override-document-step.js +85 -0
- package/dist/esm/steps/set-attrs.js +2 -2
- package/dist/esm/steps/table/add-column.js +1 -1
- package/dist/esm/steps/table/sort-column.js +2 -2
- package/dist/esm/steps/table/utils/side-effects/table.js +1 -1
- package/dist/esm/steps/type-ahead.js +2 -2
- package/dist/esm/steps.js +2 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/schema/bitbucket-schema.d.ts +1 -1
- package/dist/types/schema/confluence-schema.d.ts +1 -1
- package/dist/types/schema/create-schema.d.ts +1 -1
- package/dist/types/schema/jira-schema.d.ts +1 -1
- package/dist/types/schema/marks/alignment.d.ts +1 -1
- package/dist/types/schema/marks/annotation.d.ts +1 -1
- package/dist/types/schema/marks/border.d.ts +1 -1
- package/dist/types/schema/marks/breakout.d.ts +1 -1
- package/dist/types/schema/marks/code.d.ts +1 -1
- package/dist/types/schema/marks/confluence-inline-comment.d.ts +1 -1
- package/dist/types/schema/marks/data-consumer.d.ts +1 -1
- package/dist/types/schema/marks/em.d.ts +1 -1
- package/dist/types/schema/marks/fragment.d.ts +1 -1
- package/dist/types/schema/marks/indentation.d.ts +1 -1
- package/dist/types/schema/marks/link.d.ts +1 -1
- package/dist/types/schema/marks/strike.d.ts +1 -1
- package/dist/types/schema/marks/strong.d.ts +1 -1
- package/dist/types/schema/marks/subsup.d.ts +1 -1
- package/dist/types/schema/marks/text-color.d.ts +1 -1
- package/dist/types/schema/marks/type-ahead-query.d.ts +1 -1
- package/dist/types/schema/marks/underline.d.ts +1 -1
- package/dist/types/schema/marks/unsupported-mark.d.ts +1 -1
- package/dist/types/schema/marks/unsupported-node-attributes.d.ts +1 -1
- package/dist/types/schema/nodes/block-card.d.ts +1 -1
- package/dist/types/schema/nodes/blockquote.d.ts +1 -1
- package/dist/types/schema/nodes/bodied-extension.d.ts +1 -1
- package/dist/types/schema/nodes/bullet-list.d.ts +1 -1
- package/dist/types/schema/nodes/caption.d.ts +1 -1
- package/dist/types/schema/nodes/code-block.d.ts +1 -1
- package/dist/types/schema/nodes/confluence-jira-issue.d.ts +1 -1
- package/dist/types/schema/nodes/confluence-unsupported-block.d.ts +1 -1
- package/dist/types/schema/nodes/confluence-unsupported-inline.d.ts +1 -1
- package/dist/types/schema/nodes/date.d.ts +1 -1
- package/dist/types/schema/nodes/decision-item.d.ts +1 -1
- package/dist/types/schema/nodes/decision-list.d.ts +1 -1
- package/dist/types/schema/nodes/doc.d.ts +1 -1
- package/dist/types/schema/nodes/embed-card.d.ts +1 -1
- package/dist/types/schema/nodes/emoji.d.ts +1 -1
- package/dist/types/schema/nodes/expand.d.ts +1 -1
- package/dist/types/schema/nodes/extension.d.ts +1 -1
- package/dist/types/schema/nodes/hard-break.d.ts +1 -1
- package/dist/types/schema/nodes/heading.d.ts +1 -1
- package/dist/types/schema/nodes/image.d.ts +1 -1
- package/dist/types/schema/nodes/inline-card.d.ts +1 -1
- package/dist/types/schema/nodes/inline-extension.d.ts +1 -1
- package/dist/types/schema/nodes/layout-column.d.ts +1 -1
- package/dist/types/schema/nodes/layout-section.d.ts +1 -1
- package/dist/types/schema/nodes/list-item.d.ts +1 -1
- package/dist/types/schema/nodes/media-group.d.ts +1 -1
- package/dist/types/schema/nodes/media-inline.d.ts +1 -1
- package/dist/types/schema/nodes/media-single.d.ts +1 -1
- package/dist/types/schema/nodes/media.d.ts +1 -1
- package/dist/types/schema/nodes/mention.d.ts +1 -1
- package/dist/types/schema/nodes/nested-expand.d.ts +1 -1
- package/dist/types/schema/nodes/ordered-list.d.ts +1 -1
- package/dist/types/schema/nodes/panel.d.ts +1 -1
- package/dist/types/schema/nodes/paragraph.d.ts +1 -1
- package/dist/types/schema/nodes/placeholder.d.ts +1 -1
- package/dist/types/schema/nodes/rule.d.ts +1 -1
- package/dist/types/schema/nodes/status.d.ts +1 -1
- package/dist/types/schema/nodes/tableNodes.d.ts +1 -1
- package/dist/types/schema/nodes/task-item.d.ts +1 -1
- package/dist/types/schema/nodes/task-list.d.ts +1 -1
- package/dist/types/schema/nodes/text.d.ts +1 -1
- package/dist/types/schema/nodes/unknown-block.d.ts +1 -1
- package/dist/types/schema/nodes/unsupported-block.d.ts +1 -1
- package/dist/types/schema/nodes/unsupported-inline.d.ts +1 -1
- package/dist/types/steps/analytics.d.ts +2 -2
- package/dist/types/steps/link-meta-step.d.ts +2 -2
- package/dist/types/steps/override-document-step.d.ts +27 -0
- package/dist/types/steps/set-attrs.d.ts +2 -2
- package/dist/types/steps/table/add-column.d.ts +2 -2
- package/dist/types/steps/table/sort-column.d.ts +2 -2
- package/dist/types/steps/table/types.d.ts +1 -1
- package/dist/types/steps/table/utils/cell-step.d.ts +2 -2
- package/dist/types/steps/table/utils/cells-at-column.d.ts +1 -1
- package/dist/types/steps/table/utils/get-table-rect-from-doc.d.ts +1 -1
- package/dist/types/steps/table/utils/side-effects/rows.d.ts +2 -2
- package/dist/types/steps/table/utils/side-effects/side-effects.d.ts +2 -2
- package/dist/types/steps/table/utils/side-effects/table.d.ts +2 -2
- package/dist/types/steps/table/utils/side-effects/types.d.ts +1 -1
- package/dist/types/steps/type-ahead.d.ts +2 -2
- package/dist/types/steps.d.ts +2 -0
- package/dist/types-ts4.5/schema/bitbucket-schema.d.ts +1 -1
- package/dist/types-ts4.5/schema/confluence-schema.d.ts +1 -1
- package/dist/types-ts4.5/schema/create-schema.d.ts +1 -1
- package/dist/types-ts4.5/schema/jira-schema.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/alignment.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/annotation.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/border.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/breakout.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/code.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/confluence-inline-comment.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/data-consumer.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/em.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/fragment.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/indentation.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/link.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/strike.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/strong.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/subsup.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/text-color.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/type-ahead-query.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/underline.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/unsupported-mark.d.ts +1 -1
- package/dist/types-ts4.5/schema/marks/unsupported-node-attributes.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/block-card.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/blockquote.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/bodied-extension.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/bullet-list.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/caption.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/code-block.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/confluence-jira-issue.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/confluence-unsupported-block.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/confluence-unsupported-inline.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/date.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/decision-item.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/decision-list.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/doc.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/embed-card.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/emoji.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/expand.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/extension.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/hard-break.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/heading.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/image.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/inline-card.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/inline-extension.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/layout-column.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/layout-section.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/list-item.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/media-group.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/media-inline.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/media-single.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/media.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/mention.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/nested-expand.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/ordered-list.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/panel.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/paragraph.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/placeholder.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/rule.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/status.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/tableNodes.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/task-item.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/task-list.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/text.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/unknown-block.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/unsupported-block.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/unsupported-inline.d.ts +1 -1
- package/dist/types-ts4.5/steps/analytics.d.ts +2 -2
- package/dist/types-ts4.5/steps/link-meta-step.d.ts +2 -2
- package/dist/types-ts4.5/steps/override-document-step.d.ts +27 -0
- package/dist/types-ts4.5/steps/set-attrs.d.ts +2 -2
- package/dist/types-ts4.5/steps/table/add-column.d.ts +2 -2
- package/dist/types-ts4.5/steps/table/sort-column.d.ts +2 -2
- package/dist/types-ts4.5/steps/table/types.d.ts +1 -1
- package/dist/types-ts4.5/steps/table/utils/cell-step.d.ts +2 -2
- package/dist/types-ts4.5/steps/table/utils/cells-at-column.d.ts +1 -1
- package/dist/types-ts4.5/steps/table/utils/get-table-rect-from-doc.d.ts +1 -1
- package/dist/types-ts4.5/steps/table/utils/side-effects/rows.d.ts +2 -2
- package/dist/types-ts4.5/steps/table/utils/side-effects/side-effects.d.ts +2 -2
- package/dist/types-ts4.5/steps/table/utils/side-effects/table.d.ts +2 -2
- package/dist/types-ts4.5/steps/table/utils/side-effects/types.d.ts +1 -1
- package/dist/types-ts4.5/steps/type-ahead.d.ts +2 -2
- package/dist/types-ts4.5/steps.d.ts +2 -0
- package/package.json +3 -6
- package/report.api.md +5 -5
- package/tmp/api-report-tmp.d.ts +5 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 26.4.1
|
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
|
+
|
9
|
+
## 26.4.0
|
10
|
+
|
11
|
+
### Minor Changes
|
12
|
+
|
13
|
+
- [`1bab0faa2c8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1bab0faa2c8) - Add a new custom ProseMirror step OverrideDocumentStep for easy document replacing.
|
14
|
+
|
3
15
|
## 26.3.0
|
4
16
|
|
5
17
|
### Minor Changes
|
@@ -9,7 +9,7 @@ exports.createSchema = createSchema;
|
|
9
9
|
exports.sanitizeNodeSpecContent = sanitizeNodeSpecContent;
|
10
10
|
exports.sanitizeNodes = sanitizeNodes;
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
12
|
-
var
|
12
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
13
13
|
var _groups = require("./groups");
|
14
14
|
var _marks = require("./marks");
|
15
15
|
var _nodes = require("./nodes");
|
@@ -276,7 +276,7 @@ function createSchema(config) {
|
|
276
276
|
var nodes = addItems(nodesInOrder, nodesConfig, customNodeSpecs);
|
277
277
|
var marks = addItems(marksInOrder, marksConfig, customMarkSpecs);
|
278
278
|
nodes = sanitizeNodes(nodes, marks);
|
279
|
-
return new
|
279
|
+
return new _model.Schema({
|
280
280
|
nodes: nodes,
|
281
281
|
marks: marks
|
282
282
|
});
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.toJSON = exports.codeBlock = void 0;
|
7
|
-
var
|
7
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
8
8
|
/**
|
9
9
|
* @name codeBlock_node
|
10
10
|
*/
|
@@ -99,7 +99,7 @@ var codeBlock = {
|
|
99
99
|
}).filter(function (x) {
|
100
100
|
return x !== undefined;
|
101
101
|
}).join('\n');
|
102
|
-
return code ?
|
102
|
+
return code ? _model.Fragment.from(schema.text(code)) : _model.Fragment.empty;
|
103
103
|
}
|
104
104
|
},
|
105
105
|
// Handle GitHub/Gist paste
|
@@ -13,8 +13,8 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
13
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
16
|
-
var
|
17
|
-
var
|
16
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
17
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
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; } }
|
20
20
|
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; }
|
@@ -100,7 +100,7 @@ var AnalyticsStep = /*#__PURE__*/function (_Step) {
|
|
100
100
|
}, {
|
101
101
|
key: "apply",
|
102
102
|
value: function apply(doc) {
|
103
|
-
return
|
103
|
+
return _transform.StepResult.ok(doc);
|
104
104
|
}
|
105
105
|
}, {
|
106
106
|
key: "map",
|
@@ -116,9 +116,9 @@ var AnalyticsStep = /*#__PURE__*/function (_Step) {
|
|
116
116
|
key: "getMap",
|
117
117
|
value: function getMap() {
|
118
118
|
if (typeof this.pos === 'number') {
|
119
|
-
return new
|
119
|
+
return new _transform.StepMap([this.pos, 0, 0]);
|
120
120
|
}
|
121
|
-
return new
|
121
|
+
return new _transform.StepMap([]);
|
122
122
|
}
|
123
123
|
}, {
|
124
124
|
key: "merge",
|
@@ -139,11 +139,11 @@ var AnalyticsStep = /*#__PURE__*/function (_Step) {
|
|
139
139
|
}], [{
|
140
140
|
key: "fromJSON",
|
141
141
|
value: function fromJSON() {
|
142
|
-
return new
|
142
|
+
return new _transform.ReplaceStep(0, 0, _model.Slice.empty);
|
143
143
|
}
|
144
144
|
}]);
|
145
145
|
return AnalyticsStep;
|
146
|
-
}(
|
146
|
+
}(_transform.Step);
|
147
147
|
/** Register this step with Prosemirror */
|
148
148
|
exports.AnalyticsStep = AnalyticsStep;
|
149
|
-
|
149
|
+
_transform.Step.jsonID(analyticsStepType, AnalyticsStep);
|
@@ -11,8 +11,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
11
11
|
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
|
-
var
|
15
|
-
var
|
14
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
15
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
16
16
|
var _excluded = ["sourceEvent"];
|
17
17
|
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); }; }
|
18
18
|
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; } }
|
@@ -63,7 +63,7 @@ var LinkMetaStep = /*#__PURE__*/function (_Step) {
|
|
63
63
|
}, {
|
64
64
|
key: "apply",
|
65
65
|
value: function apply(doc) {
|
66
|
-
return
|
66
|
+
return _transform.StepResult.ok(doc);
|
67
67
|
}
|
68
68
|
}, {
|
69
69
|
key: "map",
|
@@ -78,7 +78,7 @@ var LinkMetaStep = /*#__PURE__*/function (_Step) {
|
|
78
78
|
}, {
|
79
79
|
key: "getMap",
|
80
80
|
value: function getMap() {
|
81
|
-
return new
|
81
|
+
return new _transform.StepMap([this.pos || 0, 0, 0]);
|
82
82
|
}
|
83
83
|
|
84
84
|
// Return null to avoid merging events
|
@@ -102,11 +102,11 @@ var LinkMetaStep = /*#__PURE__*/function (_Step) {
|
|
102
102
|
value: function fromJSON(_, __) {
|
103
103
|
// This is a "local custom step" once serialized
|
104
104
|
// we need to transform it in a no-operation action
|
105
|
-
return new
|
105
|
+
return new _transform.ReplaceStep(0, 0, _model.Slice.empty);
|
106
106
|
}
|
107
107
|
}]);
|
108
108
|
return LinkMetaStep;
|
109
|
-
}(
|
109
|
+
}(_transform.Step);
|
110
110
|
/** Register this step with Prosemirror */
|
111
111
|
exports.LinkMetaStep = LinkMetaStep;
|
112
|
-
|
112
|
+
_transform.Step.jsonID(stepType, LinkMetaStep);
|
@@ -0,0 +1,94 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.overrideDocumentStepType = exports.OverrideDocumentStep = void 0;
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
15
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
16
|
+
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); }; }
|
17
|
+
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; } }
|
18
|
+
var overrideDocumentStepType = 'override-document';
|
19
|
+
exports.overrideDocumentStepType = overrideDocumentStepType;
|
20
|
+
var OverrideDocumentStep = /*#__PURE__*/function (_Step) {
|
21
|
+
(0, _inherits2.default)(OverrideDocumentStep, _Step);
|
22
|
+
var _super = _createSuper(OverrideDocumentStep);
|
23
|
+
function OverrideDocumentStep(opts) {
|
24
|
+
var _this;
|
25
|
+
(0, _classCallCheck2.default)(this, OverrideDocumentStep);
|
26
|
+
_this = _super.call(this);
|
27
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "inverted", false);
|
28
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "oldDocumentSize", 0);
|
29
|
+
var inverted = opts.inverted,
|
30
|
+
nextDocument = opts.nextDocument;
|
31
|
+
if (nextDocument.type.name !== 'doc') {
|
32
|
+
throw new Error('nextDocument should be the entire prosemirror doc node and not only its content.');
|
33
|
+
}
|
34
|
+
_this.nextDocument = nextDocument;
|
35
|
+
_this.inverted = Boolean(inverted);
|
36
|
+
return _this;
|
37
|
+
}
|
38
|
+
(0, _createClass2.default)(OverrideDocumentStep, [{
|
39
|
+
key: "apply",
|
40
|
+
value: function apply(doc) {
|
41
|
+
this.oldDocumentSize = doc.content.size;
|
42
|
+
return _transform.StepResult.ok(this.nextDocument);
|
43
|
+
}
|
44
|
+
}, {
|
45
|
+
key: "map",
|
46
|
+
value: function map() {
|
47
|
+
return new OverrideDocumentStep({
|
48
|
+
nextDocument: this.nextDocument,
|
49
|
+
inverted: this.inverted
|
50
|
+
});
|
51
|
+
}
|
52
|
+
}, {
|
53
|
+
key: "getMap",
|
54
|
+
value: function getMap() {
|
55
|
+
if (!this.nextDocument || !this.oldDocumentSize) {
|
56
|
+
return new _transform.StepMap([0, 0, 0]);
|
57
|
+
}
|
58
|
+
var oldSize = this.oldDocumentSize;
|
59
|
+
var nextDocumentSize = this.nextDocument.content.size;
|
60
|
+
return new _transform.StepMap([0, oldSize, nextDocumentSize]);
|
61
|
+
}
|
62
|
+
}, {
|
63
|
+
key: "invert",
|
64
|
+
value: function invert(doc) {
|
65
|
+
return new OverrideDocumentStep({
|
66
|
+
nextDocument: doc,
|
67
|
+
inverted: true
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}, {
|
71
|
+
key: "toJSON",
|
72
|
+
value: function toJSON() {
|
73
|
+
return {
|
74
|
+
stepType: overrideDocumentStepType,
|
75
|
+
inverted: this.inverted,
|
76
|
+
nextDocument: this.nextDocument.toJSON()
|
77
|
+
};
|
78
|
+
}
|
79
|
+
}], [{
|
80
|
+
key: "fromJSON",
|
81
|
+
value: function fromJSON(schema, json) {
|
82
|
+
if (!json || json.stepType !== overrideDocumentStepType) {
|
83
|
+
throw new RangeError('Invalid overrideDocument step OverrideDocumentStep.fromJSON');
|
84
|
+
}
|
85
|
+
return new OverrideDocumentStep({
|
86
|
+
inverted: json.inverted,
|
87
|
+
nextDocument: schema.nodeFromJSON(json.nextDocument)
|
88
|
+
});
|
89
|
+
}
|
90
|
+
}]);
|
91
|
+
return OverrideDocumentStep;
|
92
|
+
}(_transform.Step);
|
93
|
+
exports.OverrideDocumentStep = OverrideDocumentStep;
|
94
|
+
_transform.Step.jsonID(overrideDocumentStepType, OverrideDocumentStep);
|
@@ -12,8 +12,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
13
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
15
|
-
var
|
16
|
-
var
|
15
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
16
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
17
17
|
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; }
|
18
18
|
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; }
|
19
19
|
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); }; }
|
@@ -38,15 +38,15 @@ var SetAttrsStep = /*#__PURE__*/function (_Step) {
|
|
38
38
|
value: function apply(doc) {
|
39
39
|
var target = doc.nodeAt(this.pos);
|
40
40
|
if (!target) {
|
41
|
-
return
|
41
|
+
return _transform.StepResult.fail('No node at given position');
|
42
42
|
}
|
43
43
|
if (target.isText) {
|
44
|
-
return
|
44
|
+
return _transform.StepResult.fail('Target is a text node. Attributes are not allowed.');
|
45
45
|
}
|
46
46
|
var attrs = _objectSpread(_objectSpread({}, target.attrs || {}), this.attrs || {});
|
47
|
-
var newNode = target.type.create(attrs,
|
48
|
-
var slice = new
|
49
|
-
return
|
47
|
+
var newNode = target.type.create(attrs, _model.Fragment.empty, target.marks);
|
48
|
+
var slice = new _model.Slice(_model.Fragment.from(newNode), 0, target.isLeaf ? 0 : 1);
|
49
|
+
return _transform.StepResult.fromReplace(doc, this.pos, this.pos + 1, slice);
|
50
50
|
}
|
51
51
|
}, {
|
52
52
|
key: "invert",
|
@@ -79,6 +79,6 @@ var SetAttrsStep = /*#__PURE__*/function (_Step) {
|
|
79
79
|
}
|
80
80
|
}]);
|
81
81
|
return SetAttrsStep;
|
82
|
-
}(
|
82
|
+
}(_transform.Step);
|
83
83
|
exports.SetAttrsStep = SetAttrsStep;
|
84
|
-
|
84
|
+
_transform.Step.jsonID('setAttrs', SetAttrsStep);
|
@@ -12,7 +12,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
12
12
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
13
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
14
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
15
|
-
var
|
15
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
16
16
|
var _cellsAtColumn = require("./utils/cells-at-column");
|
17
17
|
var _findColumn = require("./utils/find-column");
|
18
18
|
var _getTableRectFromDoc = require("./utils/get-table-rect-from-doc");
|
@@ -104,27 +104,27 @@ var AddColumnStep = /*#__PURE__*/function (_Step) {
|
|
104
104
|
value: function apply(doc) {
|
105
105
|
var tablePos = this.tablePos;
|
106
106
|
// Create transform base on the doc
|
107
|
-
var tr = new
|
107
|
+
var tr = new _transform.Transform(doc);
|
108
108
|
if (this.sideEffectsHandler.table.handleAddTable(tr, this.isDelete)) {
|
109
|
-
return
|
109
|
+
return _transform.StepResult.ok(tr.doc);
|
110
110
|
}
|
111
111
|
var tableRect;
|
112
112
|
try {
|
113
113
|
tableRect = (0, _getTableRectFromDoc.getTableRectFromDoc)(doc, tablePos);
|
114
114
|
} catch (e) {
|
115
|
-
return
|
115
|
+
return _transform.StepResult.fail(e.message);
|
116
116
|
}
|
117
117
|
var column = (0, _findColumn.findColumn)(this.columnInfo, tableRect);
|
118
118
|
if (column === null) {
|
119
|
-
return
|
119
|
+
return _transform.StepResult.fail("No column for this cells \"".concat(printColumnInfo(this.columnInfo), "\" in table at position \"").concat(tablePos, "\"."));
|
120
120
|
}
|
121
121
|
if (this.sideEffectsHandler.table.handleRemoveTable(tr, this.tablePos, tableRect, column, this.isDelete)) {
|
122
|
-
return
|
122
|
+
return _transform.StepResult.ok(tr.doc);
|
123
123
|
}
|
124
124
|
this.columnInfo = this.applyCellSteps(tr, tableRect, column, this.isDelete);
|
125
125
|
|
126
126
|
// Return the document modified.
|
127
|
-
return
|
127
|
+
return _transform.StepResult.ok(tr.doc);
|
128
128
|
}
|
129
129
|
|
130
130
|
/**
|
@@ -246,7 +246,7 @@ var AddColumnStep = /*#__PURE__*/function (_Step) {
|
|
246
246
|
ranges = this.sideEffectsHandler.rows.addRowRanges(ranges, this.isDelete);
|
247
247
|
|
248
248
|
// If no steps, I create am empty stepMap
|
249
|
-
return new
|
249
|
+
return new _transform.StepMap(ranges);
|
250
250
|
}
|
251
251
|
|
252
252
|
/**
|
@@ -376,6 +376,6 @@ var AddColumnStep = /*#__PURE__*/function (_Step) {
|
|
376
376
|
}
|
377
377
|
}]);
|
378
378
|
return AddColumnStep;
|
379
|
-
}(
|
379
|
+
}(_transform.Step);
|
380
380
|
exports.AddColumnStep = AddColumnStep;
|
381
|
-
|
381
|
+
_transform.Step.jsonID(ADD_COLUMN_STEP, AddColumnStep);
|
@@ -10,8 +10,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
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
|
14
|
-
var
|
13
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
14
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
15
15
|
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); }; }
|
16
16
|
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; } }
|
17
17
|
var tableSortingStepType = 'atlaskit-table-sorting-ordering';
|
@@ -36,7 +36,7 @@ var TableSortStep = /*#__PURE__*/function (_Step) {
|
|
36
36
|
}, {
|
37
37
|
key: "apply",
|
38
38
|
value: function apply(doc) {
|
39
|
-
return
|
39
|
+
return _transform.StepResult.ok(doc);
|
40
40
|
}
|
41
41
|
}, {
|
42
42
|
key: "map",
|
@@ -46,7 +46,7 @@ var TableSortStep = /*#__PURE__*/function (_Step) {
|
|
46
46
|
}, {
|
47
47
|
key: "getMap",
|
48
48
|
value: function getMap() {
|
49
|
-
return new
|
49
|
+
return new _transform.StepMap([0, 0, 0]);
|
50
50
|
}
|
51
51
|
}, {
|
52
52
|
key: "toJSON",
|
@@ -58,11 +58,11 @@ var TableSortStep = /*#__PURE__*/function (_Step) {
|
|
58
58
|
}], [{
|
59
59
|
key: "fromJSON",
|
60
60
|
value: function fromJSON() {
|
61
|
-
return new
|
61
|
+
return new _transform.ReplaceStep(0, 0, _model.Slice.empty);
|
62
62
|
}
|
63
63
|
}]);
|
64
64
|
return TableSortStep;
|
65
|
-
}(
|
65
|
+
}(_transform.Step);
|
66
66
|
/** Register this step with Prosemirror */
|
67
67
|
exports.TableSortStep = TableSortStep;
|
68
|
-
|
68
|
+
_transform.Step.jsonID(tableSortingStepType, TableSortStep);
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.TableSideEffectHandler = void 0;
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
10
|
-
var
|
10
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
11
11
|
var TableSideEffectHandler = /*#__PURE__*/function () {
|
12
12
|
function TableSideEffectHandler(tableSideEffect) {
|
13
13
|
(0, _classCallCheck2.default)(this, TableSideEffectHandler);
|
@@ -54,9 +54,9 @@ var TableSideEffectHandler = /*#__PURE__*/function () {
|
|
54
54
|
from = _this$table.from,
|
55
55
|
to = _this$table.to;
|
56
56
|
if (isDelete) {
|
57
|
-
return new
|
57
|
+
return new _transform.StepMap([from, to - from, 0]);
|
58
58
|
}
|
59
|
-
return new
|
59
|
+
return new _transform.StepMap([from, 0, to - from]);
|
60
60
|
}
|
61
61
|
}, {
|
62
62
|
key: "map",
|
@@ -10,8 +10,8 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
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
|
14
|
-
var
|
13
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
14
|
+
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
15
15
|
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); }; }
|
16
16
|
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; } }
|
17
17
|
var insertTypeAheadStepType = 'atlaskit-insert-type-ahead';
|
@@ -55,7 +55,7 @@ var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
|
|
55
55
|
}, {
|
56
56
|
key: "apply",
|
57
57
|
value: function apply(doc) {
|
58
|
-
return
|
58
|
+
return _transform.StepResult.ok(doc);
|
59
59
|
}
|
60
60
|
}, {
|
61
61
|
key: "merge",
|
@@ -87,7 +87,7 @@ var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
|
|
87
87
|
}, {
|
88
88
|
key: "getMap",
|
89
89
|
value: function getMap() {
|
90
|
-
return new
|
90
|
+
return new _transform.StepMap([0, 0, 0]);
|
91
91
|
}
|
92
92
|
}, {
|
93
93
|
key: "toJSON",
|
@@ -104,11 +104,11 @@ var InsertTypeAheadStep = /*#__PURE__*/function (_Step) {
|
|
104
104
|
value: function fromJSON() {
|
105
105
|
// This is a "local custom step" once serialized
|
106
106
|
// we need to transform it in a no-operation action
|
107
|
-
return new
|
107
|
+
return new _transform.ReplaceStep(0, 0, _model.Slice.empty);
|
108
108
|
}
|
109
109
|
}]);
|
110
110
|
return InsertTypeAheadStep;
|
111
|
-
}(
|
111
|
+
}(_transform.Step);
|
112
112
|
/** Register this step with Prosemirror */
|
113
113
|
exports.InsertTypeAheadStep = InsertTypeAheadStep;
|
114
|
-
|
114
|
+
_transform.Step.jsonID(insertTypeAheadStepType, InsertTypeAheadStep);
|
package/dist/cjs/steps.js
CHANGED
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "LinkMetaStep", {
|
|
33
33
|
return _linkMetaStep.LinkMetaStep;
|
34
34
|
}
|
35
35
|
});
|
36
|
+
Object.defineProperty(exports, "OverrideDocumentStep", {
|
37
|
+
enumerable: true,
|
38
|
+
get: function get() {
|
39
|
+
return _overrideDocumentStep.OverrideDocumentStep;
|
40
|
+
}
|
41
|
+
});
|
36
42
|
Object.defineProperty(exports, "SetAttrsStep", {
|
37
43
|
enumerable: true,
|
38
44
|
get: function get() {
|
@@ -57,4 +63,5 @@ var _typeAhead = require("./steps/type-ahead");
|
|
57
63
|
var _addColumn = require("./steps/table/add-column");
|
58
64
|
var _setAttrs = require("./steps/set-attrs");
|
59
65
|
var _analytics = require("./steps/analytics");
|
60
|
-
var _linkMetaStep = require("./steps/link-meta-step");
|
66
|
+
var _linkMetaStep = require("./steps/link-meta-step");
|
67
|
+
var _overrideDocumentStep = require("./steps/override-document-step");
|
package/dist/cjs/version.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Schema } from 'prosemirror
|
1
|
+
import { Schema } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
3
3
|
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
|
4
4
|
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaSingleWithCaption, mediaGroup, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, nestedExpand, embedCard, caption } from './nodes';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
-
import { Step, StepResult, StepMap, ReplaceStep } from 'prosemirror
|
3
|
-
import { Slice } from 'prosemirror
|
2
|
+
import { Step, StepResult, StepMap, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
3
|
+
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
4
4
|
export const analyticsStepType = 'atlaskit-analytics';
|
5
5
|
export const analyticsInvertStepType = 'atlaskit-analytics-invert';
|
6
6
|
var HISTORY_ACTIONS = /*#__PURE__*/function (HISTORY_ACTIONS) {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Slice } from 'prosemirror
|
2
|
-
import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror
|
1
|
+
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult } from '@atlaskit/editor-prosemirror/transform';
|
3
3
|
export const stepType = 'editor-linking-meta';
|
4
4
|
export const invertStepType = 'editor-linking-meta-invert';
|
5
5
|
/**
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
import { Step, StepResult, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
3
|
+
export const overrideDocumentStepType = 'override-document';
|
4
|
+
export class OverrideDocumentStep extends Step {
|
5
|
+
constructor(opts) {
|
6
|
+
super();
|
7
|
+
_defineProperty(this, "inverted", false);
|
8
|
+
_defineProperty(this, "oldDocumentSize", 0);
|
9
|
+
const {
|
10
|
+
inverted,
|
11
|
+
nextDocument
|
12
|
+
} = opts;
|
13
|
+
if (nextDocument.type.name !== 'doc') {
|
14
|
+
throw new Error('nextDocument should be the entire prosemirror doc node and not only its content.');
|
15
|
+
}
|
16
|
+
this.nextDocument = nextDocument;
|
17
|
+
this.inverted = Boolean(inverted);
|
18
|
+
}
|
19
|
+
apply(doc) {
|
20
|
+
this.oldDocumentSize = doc.content.size;
|
21
|
+
return StepResult.ok(this.nextDocument);
|
22
|
+
}
|
23
|
+
map() {
|
24
|
+
return new OverrideDocumentStep({
|
25
|
+
nextDocument: this.nextDocument,
|
26
|
+
inverted: this.inverted
|
27
|
+
});
|
28
|
+
}
|
29
|
+
getMap() {
|
30
|
+
if (!this.nextDocument || !this.oldDocumentSize) {
|
31
|
+
return new StepMap([0, 0, 0]);
|
32
|
+
}
|
33
|
+
const oldSize = this.oldDocumentSize;
|
34
|
+
const nextDocumentSize = this.nextDocument.content.size;
|
35
|
+
return new StepMap([0, oldSize, nextDocumentSize]);
|
36
|
+
}
|
37
|
+
invert(doc) {
|
38
|
+
return new OverrideDocumentStep({
|
39
|
+
nextDocument: doc,
|
40
|
+
inverted: true
|
41
|
+
});
|
42
|
+
}
|
43
|
+
toJSON() {
|
44
|
+
return {
|
45
|
+
stepType: overrideDocumentStepType,
|
46
|
+
inverted: this.inverted,
|
47
|
+
nextDocument: this.nextDocument.toJSON()
|
48
|
+
};
|
49
|
+
}
|
50
|
+
static fromJSON(schema, json) {
|
51
|
+
if (!json || json.stepType !== overrideDocumentStepType) {
|
52
|
+
throw new RangeError('Invalid overrideDocument step OverrideDocumentStep.fromJSON');
|
53
|
+
}
|
54
|
+
return new OverrideDocumentStep({
|
55
|
+
inverted: json.inverted,
|
56
|
+
nextDocument: schema.nodeFromJSON(json.nextDocument)
|
57
|
+
});
|
58
|
+
}
|
59
|
+
}
|
60
|
+
Step.jsonID(overrideDocumentStepType, OverrideDocumentStep);
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Step, StepResult } from 'prosemirror
|
2
|
-
import { Slice, Fragment } from 'prosemirror
|
1
|
+
import { Step, StepResult } from '@atlaskit/editor-prosemirror/transform';
|
2
|
+
import { Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* For more context on what this is about:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Step, StepMap, StepResult, Transform } from 'prosemirror
|
1
|
+
import { Step, StepMap, StepResult, Transform } from '@atlaskit/editor-prosemirror/transform';
|
2
2
|
import { cellsAtColumn } from './utils/cells-at-column';
|
3
3
|
import { findColumn } from './utils/find-column';
|
4
4
|
import { getTableRectFromDoc } from './utils/get-table-rect-from-doc';
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Slice } from 'prosemirror
|
2
|
-
import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror
|
1
|
+
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult } from '@atlaskit/editor-prosemirror/transform';
|
3
3
|
export const tableSortingStepType = 'atlaskit-table-sorting-ordering';
|
4
4
|
export class TableSortStep extends Step {
|
5
5
|
constructor(pos, prev, next) {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Slice } from 'prosemirror
|
2
|
-
import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror
|
1
|
+
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult } from '@atlaskit/editor-prosemirror/transform';
|
3
3
|
export const insertTypeAheadStepType = 'atlaskit-insert-type-ahead';
|
4
4
|
export let InsertTypeAheadStages = /*#__PURE__*/function (InsertTypeAheadStages) {
|
5
5
|
InsertTypeAheadStages["DELETING_RAW_QUERY"] = "DELETING_RAW_QUERY";
|
package/dist/es2019/steps.js
CHANGED
@@ -4,4 +4,5 @@ export { InsertTypeAheadStages, InsertTypeAheadStep } from './steps/type-ahead';
|
|
4
4
|
export { AddColumnStep } from './steps/table/add-column';
|
5
5
|
export { SetAttrsStep } from './steps/set-attrs';
|
6
6
|
export { AnalyticsStep } from './steps/analytics';
|
7
|
-
export { LinkMetaStep } from './steps/link-meta-step';
|
7
|
+
export { LinkMetaStep } from './steps/link-meta-step';
|
8
|
+
export { OverrideDocumentStep } from './steps/override-document-step';
|