@atlaskit/adf-schema 20.1.2 → 22.0.0
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 +77 -0
- package/dist/cjs/json-schema/index.js +23 -0
- package/dist/cjs/schema/create-schema.js +2 -2
- package/dist/cjs/schema/default-schema.js +1 -2
- package/dist/cjs/schema/marks/annotation.js +2 -2
- package/dist/cjs/schema/marks/fragment.js +2 -2
- package/dist/cjs/schema/marks/link.js +2 -2
- package/dist/cjs/schema/nodes/block-card.js +9 -5
- package/dist/cjs/schema/nodes/bodied-extension.js +1 -1
- package/dist/cjs/schema/nodes/doc.js +1 -1
- package/dist/cjs/schema/nodes/embed-card.js +7 -4
- package/dist/cjs/schema/nodes/emoji.js +5 -5
- package/dist/cjs/schema/nodes/expand.js +1 -1
- package/dist/cjs/schema/nodes/inline-card.js +9 -5
- package/dist/cjs/schema/nodes/layout-column.js +1 -1
- package/dist/cjs/schema/nodes/list-item.js +1 -1
- package/dist/cjs/schema/nodes/media-group.js +1 -1
- package/dist/cjs/schema/nodes/media-single.js +2 -2
- package/dist/cjs/schema/nodes/nested-expand.js +1 -1
- package/dist/cjs/schema/nodes/panel.js +12 -2
- package/dist/cjs/schema/nodes/paragraph.js +24 -145
- package/dist/cjs/schema/nodes/tableNodes.js +2 -2
- package/dist/cjs/steps/analytics.js +2 -2
- package/dist/cjs/steps/set-attrs.js +2 -2
- package/dist/cjs/steps/table/add-column.js +2 -2
- package/dist/cjs/steps/table/utils/cell-step.js +2 -2
- package/dist/cjs/steps/table/utils/side-effects/rows.js +2 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/json-schema/index.js +2 -0
- package/dist/es2019/schema/default-schema.js +2 -3
- package/dist/es2019/schema/marks/data-consumer.js +8 -1
- package/dist/es2019/schema/nodes/block-card.js +8 -5
- package/dist/es2019/schema/nodes/bodied-extension.js +1 -1
- package/dist/es2019/schema/nodes/doc.js +1 -1
- package/dist/es2019/schema/nodes/embed-card.js +6 -4
- package/dist/es2019/schema/nodes/emoji.js +5 -5
- package/dist/es2019/schema/nodes/expand.js +1 -1
- package/dist/es2019/schema/nodes/inline-card.js +9 -2
- package/dist/es2019/schema/nodes/layout-column.js +1 -1
- package/dist/es2019/schema/nodes/list-item.js +1 -1
- package/dist/es2019/schema/nodes/media-group.js +1 -1
- package/dist/es2019/schema/nodes/nested-expand.js +1 -1
- package/dist/es2019/schema/nodes/panel.js +10 -0
- package/dist/es2019/schema/nodes/paragraph.js +24 -142
- package/dist/es2019/schema/nodes/tableNodes.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/json-schema/index.js +2 -0
- package/dist/esm/schema/create-schema.js +2 -2
- package/dist/esm/schema/default-schema.js +2 -3
- package/dist/esm/schema/marks/annotation.js +2 -2
- package/dist/esm/schema/marks/data-consumer.js +8 -1
- package/dist/esm/schema/marks/fragment.js +2 -2
- package/dist/esm/schema/marks/link.js +2 -2
- package/dist/esm/schema/nodes/block-card.js +8 -5
- package/dist/esm/schema/nodes/bodied-extension.js +1 -1
- package/dist/esm/schema/nodes/doc.js +1 -1
- package/dist/esm/schema/nodes/embed-card.js +6 -4
- package/dist/esm/schema/nodes/emoji.js +5 -5
- package/dist/esm/schema/nodes/expand.js +1 -1
- package/dist/esm/schema/nodes/inline-card.js +9 -2
- package/dist/esm/schema/nodes/layout-column.js +1 -1
- package/dist/esm/schema/nodes/list-item.js +1 -1
- package/dist/esm/schema/nodes/media-group.js +1 -1
- package/dist/esm/schema/nodes/media-single.js +2 -2
- package/dist/esm/schema/nodes/nested-expand.js +1 -1
- package/dist/esm/schema/nodes/panel.js +12 -2
- package/dist/esm/schema/nodes/paragraph.js +24 -144
- package/dist/esm/schema/nodes/tableNodes.js +2 -2
- package/dist/esm/steps/analytics.js +2 -2
- package/dist/esm/steps/set-attrs.js +2 -2
- package/dist/esm/steps/table/add-column.js +2 -2
- package/dist/esm/steps/table/utils/cell-step.js +2 -2
- package/dist/esm/steps/table/utils/side-effects/rows.js +2 -2
- package/dist/esm/version.json +1 -1
- package/dist/json-schema/package.json +7 -0
- package/dist/json-schema/v1/full.json +67 -3
- package/dist/json-schema/v1/stage-0.json +36 -81
- package/dist/types/index.d.ts +1 -1
- package/dist/types/json-schema/index.d.ts +2 -0
- package/dist/types/schema/default-schema.d.ts +1 -1
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/marks/data-consumer.d.ts +8 -1
- package/dist/types/schema/marks/fragment.d.ts +0 -1
- package/dist/types/schema/nodes/block-card.d.ts +2 -0
- package/dist/types/schema/nodes/bodied-extension.d.ts +1 -6
- package/dist/types/schema/nodes/embed-card.d.ts +1 -0
- package/dist/types/schema/nodes/extension.d.ts +1 -6
- package/dist/types/schema/nodes/index.d.ts +3 -3
- package/dist/types/schema/nodes/inline-extension.d.ts +1 -6
- package/dist/types/schema/nodes/panel.d.ts +2 -0
- package/dist/types/schema/nodes/tableNodes.d.ts +4 -2
- package/dist/types/schema/nodes/types/block-content.d.ts +3 -3
- package/dist/types/schema/nodes/types/inline-content.d.ts +3 -3
- package/dist/types/schema/nodes/types/non-nestable-block-content.d.ts +2 -2
- package/json-schema/package.json +7 -0
- package/json-schema/v1/full.json +67 -3
- package/json-schema/v1/stage-0.json +36 -81
- package/package.json +10 -3
- package/schema/package.json +7 -0
- package/url/package.json +7 -0
- package/test-helpers/html-helpers.ts +0 -40
- package/test-helpers/matches.ts +0 -8
- package/test-helpers/schema-builder.ts +0 -329
- package/test-helpers/schema.ts +0 -80
@@ -221,7 +221,7 @@ var tableCell = {
|
|
221
221
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
|
222
222
|
attrs: cellAttrs,
|
223
223
|
tableRole: 'cell',
|
224
|
-
marks: '
|
224
|
+
marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
|
225
225
|
isolating: true,
|
226
226
|
parseDOM: [// Ignore number cell copied from renderer
|
227
227
|
{
|
@@ -258,7 +258,7 @@ var tableHeader = {
|
|
258
258
|
attrs: cellAttrs,
|
259
259
|
tableRole: 'header_cell',
|
260
260
|
isolating: true,
|
261
|
-
marks: '
|
261
|
+
marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
|
262
262
|
parseDOM: [{
|
263
263
|
tag: 'th',
|
264
264
|
getAttrs: function getAttrs(dom) {
|
@@ -31,9 +31,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
31
31
|
|
32
32
|
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; } }
|
33
33
|
|
34
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
34
|
+
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; }
|
35
35
|
|
36
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
36
|
+
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; }
|
37
37
|
|
38
38
|
var analyticsStepType = 'atlaskit-analytics';
|
39
39
|
exports.analyticsStepType = analyticsStepType;
|
@@ -25,9 +25,9 @@ var _prosemirrorTransform = require("prosemirror-transform");
|
|
25
25
|
|
26
26
|
var _prosemirrorModel = require("prosemirror-model");
|
27
27
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
28
|
+
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; }
|
29
29
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
30
|
+
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; }
|
31
31
|
|
32
32
|
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); }; }
|
33
33
|
|
@@ -35,9 +35,9 @@ var _sideEffects = require("./utils/side-effects/side-effects");
|
|
35
35
|
|
36
36
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
37
37
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
38
|
+
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; }
|
39
39
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
40
|
+
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; }
|
41
41
|
|
42
42
|
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); }; }
|
43
43
|
|
@@ -16,9 +16,9 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
16
16
|
|
17
17
|
var _utils = require("@atlaskit/editor-tables/utils");
|
18
18
|
|
19
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
19
|
+
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; }
|
20
20
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
21
|
+
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; }
|
22
22
|
|
23
23
|
var EmptyCellNodeSize = 4;
|
24
24
|
|
@@ -23,9 +23,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
23
23
|
|
24
24
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
25
25
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
26
|
+
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; }
|
27
27
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
28
|
+
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; }
|
29
29
|
|
30
30
|
function mergedRanges(first, second) {
|
31
31
|
var newRanges = [];
|
package/dist/cjs/version.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { layoutSectionWithSingleColumn } from './nodes';
|
2
|
-
import {
|
2
|
+
import { fragment } from './marks';
|
3
3
|
import { createSchema } from './create-schema';
|
4
4
|
|
5
5
|
const getDefaultSchemaConfig = () => {
|
6
6
|
let defaultSchemaConfig = {
|
7
7
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'caption', 'mention', 'media', 'mediaGroup', 'mediaSingle', 'mediaInline', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'hardBreak', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'decisionList', 'decisionItem', 'taskList', 'taskItem', 'unknownBlock', 'date', 'status', 'placeholder', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard', 'unsupportedBlock', 'unsupportedInline'],
|
8
|
-
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery' // https://product-fabric.atlassian.net/browse/ED-10214,
|
8
|
+
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery' // https://product-fabric.atlassian.net/browse/ED-10214,
|
9
9
|
]
|
10
10
|
};
|
11
11
|
return defaultSchemaConfig;
|
@@ -20,7 +20,6 @@ export const getSchemaBasedOnStage = (stage = 'final') => {
|
|
20
20
|
layoutSection: layoutSectionWithSingleColumn
|
21
21
|
};
|
22
22
|
defaultSchemaConfig.customMarkSpecs = {
|
23
|
-
dataConsumer: dataConsumer,
|
24
23
|
fragment
|
25
24
|
};
|
26
25
|
defaultSchemaConfig.nodes.push('mediaInline');
|
@@ -1,6 +1,13 @@
|
|
1
1
|
import { isDOMElement } from '../../utils/parseDOM';
|
2
2
|
/**
|
3
|
-
*
|
3
|
+
* This annotation is purely for reference, & does _nothing_ given annotating
|
4
|
+
* `minLength` on an array of strings is not supported with our schema+spec
|
5
|
+
* generator.
|
6
|
+
*
|
7
|
+
* We're keeping it to signal that data consumer `sources` shouldn't be empty
|
8
|
+
* strings
|
9
|
+
*
|
10
|
+
* // @minLength 1
|
4
11
|
*/
|
5
12
|
|
6
13
|
const parseDataConsumer = maybeValue => {
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
* @name blockCard_node
|
3
|
-
*/
|
1
|
+
import { uuid } from '../../utils/uuid';
|
4
2
|
export const blockCard = {
|
5
3
|
inline: false,
|
6
4
|
group: 'block',
|
@@ -12,6 +10,9 @@ export const blockCard = {
|
|
12
10
|
},
|
13
11
|
data: {
|
14
12
|
default: null
|
13
|
+
},
|
14
|
+
localId: {
|
15
|
+
default: ''
|
15
16
|
}
|
16
17
|
},
|
17
18
|
parseDOM: [{
|
@@ -23,7 +24,8 @@ export const blockCard = {
|
|
23
24
|
const data = anchor.getAttribute('data-card-data');
|
24
25
|
return {
|
25
26
|
url: anchor.getAttribute('href') || null,
|
26
|
-
data: data ? JSON.parse(data) : null
|
27
|
+
data: data ? JSON.parse(data) : null,
|
28
|
+
localId: uuid.generate()
|
27
29
|
};
|
28
30
|
}
|
29
31
|
}, {
|
@@ -33,7 +35,8 @@ export const blockCard = {
|
|
33
35
|
const data = anchor.getAttribute('data-card-data');
|
34
36
|
return {
|
35
37
|
url: anchor.getAttribute('data-card-url') || null,
|
36
|
-
data: data ? JSON.parse(data) : null
|
38
|
+
data: data ? JSON.parse(data) : null,
|
39
|
+
localId: uuid.generate()
|
37
40
|
};
|
38
41
|
}
|
39
42
|
}],
|
@@ -4,7 +4,7 @@ const createBodiedExtensionNodeSpec = () => {
|
|
4
4
|
const nodeSpec = {
|
5
5
|
inline: false,
|
6
6
|
group: 'block',
|
7
|
-
marks: '
|
7
|
+
marks: 'dataConsumer fragment',
|
8
8
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | blockCard | extension | unsupportedBlock | embedCard)+',
|
9
9
|
defining: true,
|
10
10
|
selectable: true,
|
@@ -3,5 +3,5 @@
|
|
3
3
|
*/
|
4
4
|
export const doc = {
|
5
5
|
content: '(block|layoutSection)+',
|
6
|
-
marks: 'alignment breakout dataConsumer fragment indentation
|
6
|
+
marks: 'alignment breakout dataConsumer fragment indentation unsupportedMark unsupportedNodeAttribute'
|
7
7
|
};
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
* @name embedCard_node
|
3
|
-
*/
|
1
|
+
import { uuid } from '../../utils/uuid';
|
4
2
|
export const embedCard = {
|
5
3
|
inline: false,
|
6
4
|
group: 'block',
|
@@ -20,6 +18,9 @@ export const embedCard = {
|
|
20
18
|
},
|
21
19
|
originalHeight: {
|
22
20
|
default: null
|
21
|
+
},
|
22
|
+
localId: {
|
23
|
+
default: ''
|
23
24
|
}
|
24
25
|
},
|
25
26
|
parseDOM: [{
|
@@ -29,7 +30,8 @@ export const embedCard = {
|
|
29
30
|
layout: dom.getAttribute('data-layout') || 'center',
|
30
31
|
width: Number(dom.getAttribute('data-width')) || null,
|
31
32
|
originalWidth: Number(dom.getAttribute('data-card-original-width')) || null,
|
32
|
-
originalHeight: Number(dom.getAttribute('data-card-original-height')) || null
|
33
|
+
originalHeight: Number(dom.getAttribute('data-card-original-height')) || null,
|
34
|
+
localId: uuid.generate()
|
33
35
|
})
|
34
36
|
}],
|
35
37
|
|
@@ -18,7 +18,11 @@ export const emoji = {
|
|
18
18
|
default: ''
|
19
19
|
}
|
20
20
|
},
|
21
|
-
parseDOM: [
|
21
|
+
parseDOM: [// Handle copy/paste beautiful panel from renderer />
|
22
|
+
{
|
23
|
+
tag: 'div.ak-editor-panel__icon span',
|
24
|
+
ignore: true
|
25
|
+
}, {
|
22
26
|
tag: 'span[data-emoji-short-name]',
|
23
27
|
getAttrs: domNode => {
|
24
28
|
const dom = domNode;
|
@@ -28,10 +32,6 @@ export const emoji = {
|
|
28
32
|
text: dom.getAttribute('data-emoji-text') || emoji.attrs.text.default
|
29
33
|
};
|
30
34
|
}
|
31
|
-
}, // Handle copy/paste beautiful panel from renderer />
|
32
|
-
{
|
33
|
-
tag: 'div.ak-editor-panel__icon',
|
34
|
-
ignore: true
|
35
35
|
}, // Handle copy/paste from old <ac:emoticon />
|
36
36
|
{
|
37
37
|
tag: 'img[data-emoticon-name]',
|
@@ -20,7 +20,7 @@ function getExpandAttrs(domNode) {
|
|
20
20
|
export const expand = {
|
21
21
|
inline: false,
|
22
22
|
group: 'block',
|
23
|
-
marks: '
|
23
|
+
marks: 'dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
|
24
24
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | blockCard | embedCard | extension | unsupportedBlock)+',
|
25
25
|
isolating: true,
|
26
26
|
selectable: true,
|
@@ -1,6 +1,8 @@
|
|
1
|
+
import { uuid } from '../../utils/uuid';
|
1
2
|
/**
|
2
3
|
* @name inlineCard_node
|
3
4
|
*/
|
5
|
+
|
4
6
|
export const inlineCard = {
|
5
7
|
inline: true,
|
6
8
|
group: 'inline',
|
@@ -12,6 +14,9 @@ export const inlineCard = {
|
|
12
14
|
},
|
13
15
|
data: {
|
14
16
|
default: null
|
17
|
+
},
|
18
|
+
localId: {
|
19
|
+
default: ''
|
15
20
|
}
|
16
21
|
},
|
17
22
|
parseDOM: [{
|
@@ -25,7 +30,8 @@ export const inlineCard = {
|
|
25
30
|
|
26
31
|
return {
|
27
32
|
url: anchor.getAttribute('href') || anchor.getAttribute('data-card-url') || null,
|
28
|
-
data: data ? JSON.parse(data) : null
|
33
|
+
data: data ? JSON.parse(data) : null,
|
34
|
+
localId: uuid.generate()
|
29
35
|
};
|
30
36
|
}
|
31
37
|
}, // for renderer
|
@@ -36,7 +42,8 @@ export const inlineCard = {
|
|
36
42
|
const data = anchor.getAttribute('data-card-data');
|
37
43
|
return {
|
38
44
|
url: anchor.getAttribute('data-card-url'),
|
39
|
-
data: data ? JSON.parse(data) : null
|
45
|
+
data: data ? JSON.parse(data) : null,
|
46
|
+
localId: uuid.generate()
|
40
47
|
};
|
41
48
|
}
|
42
49
|
}],
|
@@ -4,7 +4,7 @@
|
|
4
4
|
export const layoutColumn = {
|
5
5
|
content: '(block|unsupportedBlock)+',
|
6
6
|
isolating: true,
|
7
|
-
marks: '
|
7
|
+
marks: 'alignment indentation dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
|
8
8
|
selectable: false,
|
9
9
|
attrs: {
|
10
10
|
width: {
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
export const listItem = {
|
8
8
|
content: '(paragraph | mediaSingle | codeBlock) (paragraph | bulletList | orderedList | mediaSingle | codeBlock)*',
|
9
|
-
marks: '
|
9
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
10
10
|
defining: true,
|
11
11
|
selectable: false,
|
12
12
|
parseDOM: [{
|
@@ -6,7 +6,7 @@ export const mediaGroup = {
|
|
6
6
|
group: 'block',
|
7
7
|
content: '(media|unsupportedBlock)+',
|
8
8
|
attrs: {},
|
9
|
-
marks: 'unsupportedMark unsupportedNodeAttribute
|
9
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
10
10
|
selectable: false,
|
11
11
|
parseDOM: [{
|
12
12
|
tag: 'div[data-node-type="mediaGroup"]'
|
@@ -13,7 +13,7 @@
|
|
13
13
|
*/
|
14
14
|
export const nestedExpand = {
|
15
15
|
inline: false,
|
16
|
-
marks: '
|
16
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
17
17
|
content: '(paragraph | heading | mediaSingle | mediaGroup | unsupportedBlock)+',
|
18
18
|
isolating: true,
|
19
19
|
selectable: true,
|
@@ -18,6 +18,12 @@ const getDefaultAttrs = () => {
|
|
18
18
|
panelIcon: {
|
19
19
|
default: null
|
20
20
|
},
|
21
|
+
panelIconId: {
|
22
|
+
default: null
|
23
|
+
},
|
24
|
+
panelIconText: {
|
25
|
+
default: null
|
26
|
+
},
|
21
27
|
panelColor: {
|
22
28
|
default: null
|
23
29
|
}
|
@@ -29,6 +35,8 @@ const getDomAttrs = nodeAttrs => {
|
|
29
35
|
let attrs = {
|
30
36
|
'data-panel-type': nodeAttrs.panelType,
|
31
37
|
'data-panel-icon': nodeAttrs.panelIcon,
|
38
|
+
'data-panel-icon-id': nodeAttrs.panelIconId,
|
39
|
+
'data-panel-icon-text': nodeAttrs.panelIconText,
|
32
40
|
'data-panel-color': nodeAttrs.panelColor
|
33
41
|
};
|
34
42
|
return attrs;
|
@@ -42,6 +50,8 @@ const getParseDOMAttrs = (allowCustomPanel, dom) => {
|
|
42
50
|
if (allowCustomPanel) {
|
43
51
|
parseDOMAttrs = { ...parseDOMAttrs,
|
44
52
|
panelIcon: dom.getAttribute('data-panel-icon'),
|
53
|
+
panelIconId: dom.getAttribute('data-panel-icon-id'),
|
54
|
+
panelIconText: dom.getAttribute('data-panel-icon-text'),
|
45
55
|
panelColor: dom.getAttribute('data-panel-color')
|
46
56
|
};
|
47
57
|
} else {
|
@@ -1,68 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
article: true,
|
26
|
-
aside: true,
|
27
|
-
blockquote: true,
|
28
|
-
canvas: true,
|
29
|
-
dd: true,
|
30
|
-
div: true,
|
31
|
-
dl: true,
|
32
|
-
fieldset: true,
|
33
|
-
figcaption: true,
|
34
|
-
figure: true,
|
35
|
-
footer: true,
|
36
|
-
form: true,
|
37
|
-
h1: true,
|
38
|
-
h2: true,
|
39
|
-
h3: true,
|
40
|
-
h4: true,
|
41
|
-
h5: true,
|
42
|
-
h6: true,
|
43
|
-
header: true,
|
44
|
-
hgroup: true,
|
45
|
-
hr: true,
|
46
|
-
li: true,
|
47
|
-
noscript: true,
|
48
|
-
ol: true,
|
49
|
-
output: true,
|
50
|
-
p: true,
|
51
|
-
pre: true,
|
52
|
-
section: true,
|
53
|
-
table: true,
|
54
|
-
tfoot: true,
|
55
|
-
ul: true
|
56
|
-
};
|
57
|
-
|
58
|
-
const isListItemNode = node => {
|
59
|
-
return Boolean(node && node.nodeName.toLowerCase() === 'li');
|
60
|
-
};
|
61
|
-
|
62
|
-
const isTextNode = node => {
|
63
|
-
return Boolean(node && node.nodeType === Node.TEXT_NODE);
|
64
|
-
};
|
65
|
-
|
1
|
+
/**
|
2
|
+
* @name paragraph_node
|
3
|
+
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @name paragraph_with_no_marks_node
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* NOTE: Need this because TS is too smart and inline everything.
|
11
|
+
* So we need to give them separate identity.
|
12
|
+
* Probably there's a way to solve it but that will need time and exploration.
|
13
|
+
* // http://bit.ly/2raXFX5
|
14
|
+
* type T1 = X | Y
|
15
|
+
* type T2 = A | T1 | B // T2 = A | X | Y | B
|
16
|
+
*/
|
17
|
+
|
18
|
+
/**
|
19
|
+
* @name paragraph_with_alignment_node
|
20
|
+
*/
|
21
|
+
|
22
|
+
/**
|
23
|
+
* @name paragraph_with_indentation_node
|
24
|
+
*/
|
66
25
|
const isImageNode = node => {
|
67
26
|
return Boolean(node && node.nodeName.toLowerCase() === 'img');
|
68
27
|
};
|
@@ -83,21 +42,6 @@ const hasInlineImage = node => {
|
|
83
42
|
});
|
84
43
|
};
|
85
44
|
|
86
|
-
const hasWhiteSpacePre = node => {
|
87
|
-
return Boolean(node instanceof HTMLElement && node.style.whiteSpace === 'pre');
|
88
|
-
};
|
89
|
-
|
90
|
-
const hasFontFamilyMonospace = node => {
|
91
|
-
return Boolean(node instanceof HTMLElement && node.style.fontFamily.includes('monospace'));
|
92
|
-
};
|
93
|
-
|
94
|
-
const isBlockLevelNode = node => {
|
95
|
-
return Boolean(node && blockTags.hasOwnProperty(node.nodeName.toLowerCase()));
|
96
|
-
};
|
97
|
-
|
98
|
-
const NOT_INTERNAL_LINKS = [':not([data-inline-card])', ':not([data-block-card])', ':not([data-block-link])', ':not([data-skip-paste])'].join('');
|
99
|
-
const ANCHOR_LINK = `a[href]${NOT_INTERNAL_LINKS}`;
|
100
|
-
const NOT_INTERNAL_ELEMENTS = [':not(.code-block)', ':not([data-node-type])', ':not([data-embed-card])', ':not([data-layout-section])', ':not([data-task-local-id])', ':not([data-task-state])', ':not([data-pm-slice])', ':not([data-mark-type])', ':not([data-layout-content])', ':not([data-panel-content])'].join('');
|
101
45
|
const pDOM = ['p', 0];
|
102
46
|
export const paragraph = {
|
103
47
|
selectable: false,
|
@@ -106,68 +50,6 @@ export const paragraph = {
|
|
106
50
|
marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer fragment',
|
107
51
|
parseDOM: [{
|
108
52
|
tag: 'p'
|
109
|
-
}, {
|
110
|
-
tag: `div${NOT_INTERNAL_ELEMENTS}, li:not([data-pm-slice])`,
|
111
|
-
priority: 100,
|
112
|
-
getAttrs: node => {
|
113
|
-
if (!(node instanceof Node)) {
|
114
|
-
return false;
|
115
|
-
}
|
116
|
-
|
117
|
-
const isCodeBlock = hasWhiteSpacePre(node) || hasFontFamilyMonospace(node);
|
118
|
-
|
119
|
-
if (isCodeBlock || !node.hasChildNodes()) {
|
120
|
-
return false;
|
121
|
-
}
|
122
|
-
|
123
|
-
const hasInlineChildren = Array.from(node.childNodes).every(child => !isBlockLevelNode(child) && // IMG is considered block for mediaSingle
|
124
|
-
!isImageNode(child));
|
125
|
-
|
126
|
-
if (!hasInlineChildren) {
|
127
|
-
return false;
|
128
|
-
}
|
129
|
-
|
130
|
-
if ( // We can skip this rule for pure list items
|
131
|
-
isListItemNode(node) && Array.from(node.childNodes).every(isTextNode)) {
|
132
|
-
return false;
|
133
|
-
}
|
134
|
-
|
135
|
-
return null;
|
136
|
-
}
|
137
|
-
}, {
|
138
|
-
tag: `:not(span) + ${ANCHOR_LINK}`,
|
139
|
-
priority: 100,
|
140
|
-
getContent: getLinkContent
|
141
|
-
}, {
|
142
|
-
tag: `:not(span) > ${ANCHOR_LINK}:first-child`,
|
143
|
-
getAttrs: node => {
|
144
|
-
if (!(node instanceof Node)) {
|
145
|
-
return false;
|
146
|
-
}
|
147
|
-
|
148
|
-
if (isBlockLevelNode(node.firstChild)) {
|
149
|
-
return null;
|
150
|
-
}
|
151
|
-
|
152
|
-
if (hasInlineImage(node)) {
|
153
|
-
return false;
|
154
|
-
}
|
155
|
-
|
156
|
-
const isNextSiblingValid = node.nextSibling === null || node.nextSibling instanceof Text && (node.nextSibling.textContent || '').trim().length === 0;
|
157
|
-
|
158
|
-
if (isNextSiblingValid) {
|
159
|
-
return null;
|
160
|
-
} // This rule should not match when there is any sibling after the anchor
|
161
|
-
|
162
|
-
|
163
|
-
if (!isBlockLevelNode(node.nextSibling)) {
|
164
|
-
return false;
|
165
|
-
}
|
166
|
-
|
167
|
-
return null;
|
168
|
-
},
|
169
|
-
priority: 100,
|
170
|
-
getContent: getLinkContent
|
171
53
|
}],
|
172
54
|
|
173
55
|
toDOM() {
|
@@ -183,7 +183,7 @@ export const tableCell = {
|
|
183
183
|
content: '(paragraph | panel | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaSingle | mediaGroup | decisionList | taskList | blockCard | embedCard | extension | nestedExpand | unsupportedBlock)+',
|
184
184
|
attrs: cellAttrs,
|
185
185
|
tableRole: 'cell',
|
186
|
-
marks: '
|
186
|
+
marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
|
187
187
|
isolating: true,
|
188
188
|
parseDOM: [// Ignore number cell copied from renderer
|
189
189
|
{
|
@@ -210,7 +210,7 @@ export const tableHeader = {
|
|
210
210
|
attrs: cellAttrs,
|
211
211
|
tableRole: 'header_cell',
|
212
212
|
isolating: true,
|
213
|
-
marks: '
|
213
|
+
marks: 'alignment dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
|
214
214
|
parseDOM: [{
|
215
215
|
tag: 'th',
|
216
216
|
getAttrs: dom => getCellAttrs(dom, {
|
package/dist/es2019/version.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
3
|
+
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; }
|
4
4
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
5
|
+
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) { _defineProperty(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; }
|
6
6
|
|
7
7
|
import { Schema } from 'prosemirror-model';
|
8
8
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { layoutSectionWithSingleColumn } from './nodes';
|
2
|
-
import {
|
2
|
+
import { fragment } from './marks';
|
3
3
|
import { createSchema } from './create-schema';
|
4
4
|
|
5
5
|
var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
|
6
6
|
var defaultSchemaConfig = {
|
7
7
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'caption', 'mention', 'media', 'mediaGroup', 'mediaSingle', 'mediaInline', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'hardBreak', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'decisionList', 'decisionItem', 'taskList', 'taskItem', 'unknownBlock', 'date', 'status', 'placeholder', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard', 'unsupportedBlock', 'unsupportedInline'],
|
8
|
-
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery' // https://product-fabric.atlassian.net/browse/ED-10214,
|
8
|
+
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery' // https://product-fabric.atlassian.net/browse/ED-10214,
|
9
9
|
]
|
10
10
|
};
|
11
11
|
return defaultSchemaConfig;
|
@@ -21,7 +21,6 @@ export var getSchemaBasedOnStage = function getSchemaBasedOnStage() {
|
|
21
21
|
layoutSection: layoutSectionWithSingleColumn
|
22
22
|
};
|
23
23
|
defaultSchemaConfig.customMarkSpecs = {
|
24
|
-
dataConsumer: dataConsumer,
|
25
24
|
fragment: fragment
|
26
25
|
};
|
27
26
|
defaultSchemaConfig.nodes.push('mediaInline');
|