@atlaskit/adf-schema 25.3.2 → 25.5.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 +22 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/schema/create-schema.js +3 -0
- package/dist/cjs/schema/default-schema.js +4 -0
- package/dist/cjs/schema/index.js +12 -0
- package/dist/cjs/schema/jira-schema.js +4 -0
- package/dist/cjs/schema/marks/alignment.js +4 -0
- package/dist/cjs/schema/marks/border.js +58 -0
- package/dist/cjs/schema/marks/breakout.js +5 -0
- package/dist/cjs/schema/marks/code.js +4 -0
- package/dist/cjs/schema/marks/data-consumer.js +17 -0
- package/dist/cjs/schema/marks/em.js +4 -0
- package/dist/cjs/schema/marks/fragment.js +6 -0
- package/dist/cjs/schema/marks/indentation.js +4 -0
- package/dist/cjs/schema/marks/index.js +14 -1
- package/dist/cjs/schema/marks/link.js +4 -0
- package/dist/cjs/schema/marks/strike.js +4 -0
- package/dist/cjs/schema/marks/strong.js +4 -0
- package/dist/cjs/schema/marks/subsup.js +4 -0
- package/dist/cjs/schema/marks/text-color.js +4 -0
- package/dist/cjs/schema/marks/underline.js +4 -0
- package/dist/cjs/schema/nodes/bodied-extension.js +8 -0
- package/dist/cjs/schema/nodes/code-block.js +12 -0
- package/dist/cjs/schema/nodes/decision-item.js +4 -0
- package/dist/cjs/schema/nodes/decision-list.js +4 -0
- package/dist/cjs/schema/nodes/emoji.js +4 -0
- package/dist/cjs/schema/nodes/extension.js +8 -0
- package/dist/cjs/schema/nodes/inline-extension.js +8 -0
- package/dist/cjs/schema/nodes/media-group.js +4 -1
- package/dist/cjs/schema/nodes/media-inline.js +4 -0
- package/dist/cjs/schema/nodes/media-single.js +1 -1
- package/dist/cjs/schema/nodes/media.js +4 -0
- package/dist/cjs/schema/nodes/mention.js +3 -0
- package/dist/cjs/schema/nodes/panel.js +3 -0
- package/dist/cjs/schema/nodes/paragraph.js +0 -3
- package/dist/cjs/schema/nodes/status.js +4 -0
- package/dist/cjs/schema/nodes/tableNodes.js +23 -0
- package/dist/cjs/schema/nodes/task-item.js +4 -0
- package/dist/cjs/schema/nodes/task-list.js +4 -0
- package/dist/cjs/steps/link-meta-step.js +112 -0
- package/dist/cjs/steps/table/utils/cells-at-column.js +4 -4
- package/dist/cjs/steps.js +8 -1
- package/dist/cjs/utils/colors.js +7 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/schema/create-schema.js +4 -1
- package/dist/es2019/schema/default-schema.js +4 -0
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/jira-schema.js +5 -0
- package/dist/es2019/schema/marks/alignment.js +5 -0
- package/dist/es2019/schema/marks/border.js +44 -0
- package/dist/es2019/schema/marks/breakout.js +5 -0
- package/dist/es2019/schema/marks/data-consumer.js +6 -0
- package/dist/es2019/schema/marks/fragment.js +7 -0
- package/dist/es2019/schema/marks/indentation.js +5 -0
- package/dist/es2019/schema/marks/index.js +2 -1
- package/dist/es2019/schema/marks/link.js +5 -0
- package/dist/es2019/schema/marks/subsup.js +5 -0
- package/dist/es2019/schema/marks/text-color.js +5 -0
- package/dist/es2019/schema/nodes/bodied-extension.js +9 -0
- package/dist/es2019/schema/nodes/code-block.js +13 -0
- package/dist/es2019/schema/nodes/decision-item.js +5 -0
- package/dist/es2019/schema/nodes/extension.js +9 -0
- package/dist/es2019/schema/nodes/heading.js +0 -2
- package/dist/es2019/schema/nodes/inline-extension.js +9 -0
- package/dist/es2019/schema/nodes/layout-section.js +0 -3
- package/dist/es2019/schema/nodes/media-group.js +4 -1
- package/dist/es2019/schema/nodes/media-inline.js +5 -0
- package/dist/es2019/schema/nodes/media-single.js +1 -1
- package/dist/es2019/schema/nodes/media.js +5 -0
- package/dist/es2019/schema/nodes/mention.js +3 -0
- package/dist/es2019/schema/nodes/panel.js +3 -0
- package/dist/es2019/schema/nodes/paragraph.js +0 -3
- package/dist/es2019/schema/nodes/tableNodes.js +23 -0
- package/dist/es2019/schema/nodes/task-item.js +5 -0
- package/dist/es2019/schema/nodes/task-list.js +5 -0
- package/dist/es2019/steps/link-meta-step.js +71 -0
- package/dist/es2019/steps.js +2 -1
- package/dist/es2019/utils/colors.js +3 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/schema/create-schema.js +4 -1
- package/dist/esm/schema/default-schema.js +4 -0
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/jira-schema.js +5 -0
- package/dist/esm/schema/marks/alignment.js +5 -0
- package/dist/esm/schema/marks/border.js +50 -0
- package/dist/esm/schema/marks/breakout.js +5 -0
- package/dist/esm/schema/marks/data-consumer.js +6 -0
- package/dist/esm/schema/marks/fragment.js +7 -0
- package/dist/esm/schema/marks/indentation.js +5 -0
- package/dist/esm/schema/marks/index.js +2 -1
- package/dist/esm/schema/marks/link.js +5 -0
- package/dist/esm/schema/marks/subsup.js +5 -0
- package/dist/esm/schema/marks/text-color.js +5 -0
- package/dist/esm/schema/nodes/bodied-extension.js +9 -0
- package/dist/esm/schema/nodes/code-block.js +13 -0
- package/dist/esm/schema/nodes/decision-item.js +5 -0
- package/dist/esm/schema/nodes/extension.js +9 -0
- package/dist/esm/schema/nodes/heading.js +0 -2
- package/dist/esm/schema/nodes/inline-extension.js +9 -0
- package/dist/esm/schema/nodes/layout-section.js +0 -3
- package/dist/esm/schema/nodes/media-group.js +4 -1
- package/dist/esm/schema/nodes/media-inline.js +5 -0
- package/dist/esm/schema/nodes/media-single.js +1 -1
- package/dist/esm/schema/nodes/media.js +5 -0
- package/dist/esm/schema/nodes/mention.js +3 -0
- package/dist/esm/schema/nodes/panel.js +3 -0
- package/dist/esm/schema/nodes/paragraph.js +0 -3
- package/dist/esm/schema/nodes/tableNodes.js +23 -0
- package/dist/esm/schema/nodes/task-item.js +5 -0
- package/dist/esm/schema/nodes/task-list.js +5 -0
- package/dist/esm/steps/link-meta-step.js +103 -0
- package/dist/esm/steps/table/utils/cells-at-column.js +4 -3
- package/dist/esm/steps.js +2 -1
- package/dist/esm/utils/colors.js +3 -0
- package/dist/esm/version.json +1 -1
- package/dist/json-schema/v1/stage-0.json +42 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/schema/index.d.ts +2 -2
- package/dist/types/schema/marks/border.d.ts +24 -0
- package/dist/types/schema/marks/index.d.ts +2 -0
- package/dist/types/schema/nodes/media.d.ts +2 -1
- package/dist/types/steps/link-meta-step.d.ts +51 -0
- package/dist/types/steps.d.ts +2 -0
- package/dist/types/utils/colors.d.ts +3 -0
- package/json-schema/v1/stage-0.json +42 -1
- package/package.json +4 -4
- package/report.api.md +24 -1
@@ -114,6 +114,29 @@ export const tableBackgroundColorNames = new Map();
|
|
114
114
|
tableBackgroundColorPalette.set(colorValue.toLowerCase(), colorName);
|
115
115
|
tableBackgroundColorNames.set(colorName.toLowerCase(), colorValue.toLowerCase());
|
116
116
|
});
|
117
|
+
|
118
|
+
/**
|
119
|
+
* @name table_node
|
120
|
+
*/
|
121
|
+
|
122
|
+
/**
|
123
|
+
* @name table_row_node
|
124
|
+
*/
|
125
|
+
|
126
|
+
/**
|
127
|
+
* @name table_cell_content
|
128
|
+
* @minItems 1
|
129
|
+
* @allowUnsupportedBlock true
|
130
|
+
*/
|
131
|
+
|
132
|
+
/**
|
133
|
+
* @name table_cell_node
|
134
|
+
*/
|
135
|
+
|
136
|
+
/**
|
137
|
+
* @name table_header_node
|
138
|
+
*/
|
139
|
+
|
117
140
|
// TODO: Fix any, potential issue. ED-5048
|
118
141
|
const createTableSpec = () => {
|
119
142
|
const attrs = {
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import { Slice } from 'prosemirror-model';
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror-transform';
|
3
|
+
export const stepType = 'editor-linking-meta';
|
4
|
+
export const invertStepType = 'editor-linking-meta-invert';
|
5
|
+
/**
|
6
|
+
* Custom Prosemirror Step to attach metadata about user interactions with links
|
7
|
+
* Using a Step means that it will work with prosemirror-history and we get utilise when
|
8
|
+
* firing events on history change
|
9
|
+
*/
|
10
|
+
export class LinkMetaStep extends Step {
|
11
|
+
constructor(pos, metadata, isInverted = false) {
|
12
|
+
super();
|
13
|
+
this.pos = pos;
|
14
|
+
this.metadata = metadata;
|
15
|
+
this.isInverted = isInverted;
|
16
|
+
}
|
17
|
+
getMetadata() {
|
18
|
+
return this.metadata;
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Generate new undo/redo analytics event when step is inverted
|
23
|
+
*/
|
24
|
+
invert() {
|
25
|
+
/**
|
26
|
+
* Omit sourceEvent in history
|
27
|
+
*/
|
28
|
+
const {
|
29
|
+
sourceEvent,
|
30
|
+
...metadata
|
31
|
+
} = this.metadata;
|
32
|
+
return new LinkMetaStep(this.pos, metadata, true);
|
33
|
+
}
|
34
|
+
|
35
|
+
// Should make no modifications to the doc
|
36
|
+
apply(doc) {
|
37
|
+
return StepResult.ok(doc);
|
38
|
+
}
|
39
|
+
map(mapping) {
|
40
|
+
let newPos = this.pos;
|
41
|
+
if (typeof newPos === 'number') {
|
42
|
+
newPos = mapping.map(newPos);
|
43
|
+
}
|
44
|
+
// Return the same events, this step will never be removed
|
45
|
+
return new LinkMetaStep(newPos, this.metadata, this.isInverted);
|
46
|
+
}
|
47
|
+
getMap() {
|
48
|
+
return new StepMap([this.pos || 0, 0, 0]);
|
49
|
+
}
|
50
|
+
|
51
|
+
// Return null to avoid merging events
|
52
|
+
merge() {
|
53
|
+
return null;
|
54
|
+
}
|
55
|
+
toJSON() {
|
56
|
+
// When serialized we should create a noop Replace step
|
57
|
+
return {
|
58
|
+
stepType: 'replace',
|
59
|
+
from: 0,
|
60
|
+
to: 0
|
61
|
+
};
|
62
|
+
}
|
63
|
+
static fromJSON(_, __) {
|
64
|
+
// This is a "local custom step" once serialized
|
65
|
+
// we need to transform it in a no-operation action
|
66
|
+
return new ReplaceStep(0, 0, Slice.empty);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
/** Register this step with Prosemirror */
|
71
|
+
Step.jsonID(stepType, LinkMetaStep);
|
package/dist/es2019/steps.js
CHANGED
@@ -3,4 +3,5 @@ export { TableSortStep } from './steps/table/sort-column';
|
|
3
3
|
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
|
-
export { AnalyticsStep } from './steps/analytics';
|
6
|
+
export { AnalyticsStep } from './steps/analytics';
|
7
|
+
export { LinkMetaStep } from './steps/link-meta-step';
|
@@ -39,8 +39,11 @@ export const N80 = '#97A0AF';
|
|
39
39
|
export const N90 = '#8993A4';
|
40
40
|
export const N200 = '#6B778C';
|
41
41
|
export const N300 = '#5E6C84';
|
42
|
+
export const N300A = '#091E4224';
|
42
43
|
export const N500 = '#42526E';
|
44
|
+
export const N600 = '#758195';
|
43
45
|
export const N800 = '#172B4D';
|
46
|
+
export const N1000 = '#172B4D';
|
44
47
|
export const P50 = '#EAE6FF';
|
45
48
|
export const P75 = '#C0B6F2';
|
46
49
|
export const P100 = '#998DD9';
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
2
|
-
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './schema';
|
2
|
+
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './schema';
|
3
3
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -3,7 +3,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
3
3
|
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; }
|
4
4
|
import { Schema } from 'prosemirror-model';
|
5
5
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
6
|
-
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment } from './marks';
|
6
|
+
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
|
7
7
|
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaGroup, mediaSingleWithCaption, 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';
|
8
8
|
function addItems(builtInItems, config) {
|
9
9
|
var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
@@ -244,6 +244,9 @@ var marksInOrder = [{
|
|
244
244
|
}, {
|
245
245
|
name: 'indentation',
|
246
246
|
spec: indentation
|
247
|
+
}, {
|
248
|
+
name: 'border',
|
249
|
+
spec: border
|
247
250
|
}, {
|
248
251
|
name: 'unsupportedMark',
|
249
252
|
spec: unsupportedMark
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { layoutSectionWithSingleColumn } from './nodes';
|
2
|
+
import { border } from './marks';
|
2
3
|
import { createSchema } from './create-schema';
|
3
4
|
var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
|
4
5
|
var defaultSchemaConfig = {
|
@@ -17,6 +18,9 @@ export var getSchemaBasedOnStage = function getSchemaBasedOnStage() {
|
|
17
18
|
defaultSchemaConfig.customNodeSpecs = {
|
18
19
|
layoutSection: layoutSectionWithSingleColumn
|
19
20
|
};
|
21
|
+
defaultSchemaConfig.customMarkSpecs = {
|
22
|
+
border: border
|
23
|
+
};
|
20
24
|
}
|
21
25
|
return createSchema(defaultSchemaConfig);
|
22
26
|
};
|
package/dist/esm/schema/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
2
2
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
|
-
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
|
3
|
+
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './marks';
|
4
4
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
5
5
|
export { inlineNodes } from './inline-nodes';
|
6
6
|
export { sanitizeNodes, createSchema } from './create-schema';
|
@@ -1,4 +1,9 @@
|
|
1
1
|
import { createSchema } from './create-schema';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
5
|
+
**/
|
6
|
+
|
2
7
|
/**
|
3
8
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
4
9
|
**/
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
import { hexToEditorBorderPaletteColor } from '@atlaskit/editor-palette';
|
3
|
+
import { N300A, N600, N1000 } from '../../utils/colors';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @name border_mark
|
7
|
+
* @stage 0
|
8
|
+
* @description This mark adds decoration to an element, and any element decorated with it will also have a border style.
|
9
|
+
*/
|
10
|
+
|
11
|
+
var borderColorArrayPalette = [[N300A, 'Subtle gray'], [N600, 'Gray'], [N1000, 'Bold gray']];
|
12
|
+
export var borderColorPalette = new Map();
|
13
|
+
borderColorArrayPalette.forEach(function (_ref) {
|
14
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
15
|
+
color = _ref2[0],
|
16
|
+
label = _ref2[1];
|
17
|
+
return borderColorPalette.set(color.toLowerCase(), label);
|
18
|
+
});
|
19
|
+
export var border = {
|
20
|
+
inclusive: false,
|
21
|
+
parseDOM: [{
|
22
|
+
tag: 'div[data-mark-type="border"]',
|
23
|
+
getAttrs: function getAttrs(domNode) {
|
24
|
+
var _dom$getAttribute, _dom$getAttribute2;
|
25
|
+
var dom = domNode;
|
26
|
+
var color = ((_dom$getAttribute = dom.getAttribute('data-color')) !== null && _dom$getAttribute !== void 0 ? _dom$getAttribute : '').toLowerCase();
|
27
|
+
var size = +((_dom$getAttribute2 = dom.getAttribute('data-size')) !== null && _dom$getAttribute2 !== void 0 ? _dom$getAttribute2 : '0');
|
28
|
+
return {
|
29
|
+
size: size > 3 ? 3 : size < 1 ? false : size,
|
30
|
+
color: borderColorPalette.has(color) ? color : false
|
31
|
+
};
|
32
|
+
}
|
33
|
+
}],
|
34
|
+
attrs: {
|
35
|
+
color: {},
|
36
|
+
size: {}
|
37
|
+
},
|
38
|
+
toDOM: function toDOM(mark) {
|
39
|
+
// Note -- while there is no way to create custom colors using default tooling
|
40
|
+
// the editor does supported ad hoc color values -- and there may be content
|
41
|
+
// which has been migrated or created via apis which use such values.
|
42
|
+
var paletteColorValue = hexToEditorBorderPaletteColor(mark.attrs.color) || mark.attrs.color;
|
43
|
+
return ['div', {
|
44
|
+
'data-mark-type': 'border',
|
45
|
+
'data-color': mark.attrs.color,
|
46
|
+
'data-size': mark.attrs.size,
|
47
|
+
style: "--custom-palette-color: ".concat(paletteColorValue)
|
48
|
+
}];
|
49
|
+
}
|
50
|
+
};
|
@@ -11,6 +11,12 @@ import { isDOMElement } from '../../utils/parseDOM';
|
|
11
11
|
* // @minLength 1
|
12
12
|
*/
|
13
13
|
|
14
|
+
/**
|
15
|
+
* @name dataConsumer_mark
|
16
|
+
* @description This mark is used for metadata surrounding a node consuming data
|
17
|
+
* from a given source node
|
18
|
+
*/
|
19
|
+
|
14
20
|
var parseDataConsumer = function parseDataConsumer(maybeValue) {
|
15
21
|
var sources = isDOMElement(maybeValue) && maybeValue.getAttribute('data-sources');
|
16
22
|
try {
|
@@ -2,6 +2,13 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
3
3
|
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; }
|
4
4
|
import { isDOMElement } from '../../utils/parseDOM';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @name fragment_mark
|
8
|
+
* @description Indicates that the elements decorated with this mark belong to a "fragment" entity, which represents a collection of ADF nodes.
|
9
|
+
* This entity can be referred to later by its `localId` attribute.
|
10
|
+
*/
|
11
|
+
|
5
12
|
var parseFragment = function parseFragment(maybeValue) {
|
6
13
|
var _maybeValue$getAttrib;
|
7
14
|
if (!isDOMElement(maybeValue)) {
|
@@ -15,4 +15,5 @@ export { annotation, AnnotationMarkStates, buildDataAttributes as buildAnnotatio
|
|
15
15
|
export { unsupportedMark } from './unsupported-mark';
|
16
16
|
export { unsupportedNodeAttribute } from './unsupported-node-attributes';
|
17
17
|
export { dataConsumer, toJSON as dataConsumerToJSON } from './data-consumer';
|
18
|
-
export { fragment, toJSON as fragmentToJSON } from './fragment';
|
18
|
+
export { fragment, toJSON as fragmentToJSON } from './fragment';
|
19
|
+
export { border, borderColorPalette } from './border';
|
@@ -3,6 +3,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
3
3
|
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; }
|
4
4
|
import { LINK } from '../groups';
|
5
5
|
import { isRootRelative, isSafeUrl, normalizeUrl } from '../../utils/url';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @name link_mark
|
9
|
+
*/
|
10
|
+
|
6
11
|
var getLinkAttrs = function getLinkAttrs(attribute) {
|
7
12
|
return function (domNode) {
|
8
13
|
var dom = domNode;
|
@@ -3,6 +3,11 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
|
4
4
|
import { COLOR } from '../groups';
|
5
5
|
import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500 } from '../../utils/colors';
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @name textColor_mark
|
9
|
+
*/
|
10
|
+
|
6
11
|
// used for extended palette in text color picker
|
7
12
|
var colorArrayPalette = [
|
8
13
|
// default row - first color is added programatically
|
@@ -1,4 +1,13 @@
|
|
1
1
|
import { getExtensionAttrs } from '../../utils/extensions';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @name bodiedExtension_node
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @name bodiedExtension_with_marks_node
|
9
|
+
*/
|
10
|
+
|
2
11
|
var createBodiedExtensionNodeSpec = function createBodiedExtensionNodeSpec() {
|
3
12
|
var nodeSpec = {
|
4
13
|
inline: false,
|
@@ -1,4 +1,17 @@
|
|
1
1
|
import { Fragment } from 'prosemirror-model';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @name codeBlock_node
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @name codeBlock_with_no_marks_node
|
9
|
+
*/
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @name codeBlock_with_marks_node
|
13
|
+
*/
|
14
|
+
|
2
15
|
var getLanguageFromEditorStyle = function getLanguageFromEditorStyle(dom) {
|
3
16
|
return dom.getAttribute('data-language') || undefined;
|
4
17
|
};
|
@@ -1,4 +1,13 @@
|
|
1
1
|
import { getExtensionAttrs } from '../../utils/extensions';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @name extension_node
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @name extension_with_marks_node
|
9
|
+
*/
|
10
|
+
|
2
11
|
var createExtensionNodeSpec = function createExtensionNodeSpec() {
|
3
12
|
var nodeSpec = {
|
4
13
|
inline: false,
|
@@ -1,4 +1,13 @@
|
|
1
1
|
import { getExtensionAttrs } from '../../utils/extensions';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @name inlineExtension_node
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @name inlineExtension_with_marks_node
|
9
|
+
*/
|
10
|
+
|
2
11
|
var createInlineExtensionNodeSpec = function createInlineExtensionNodeSpec() {
|
3
12
|
var nodeSpec = {
|
4
13
|
inline: true,
|
@@ -5,16 +5,13 @@
|
|
5
5
|
/**
|
6
6
|
* Need duplicate `type` and `marks` to make both validator and json-schema satisfied
|
7
7
|
*/
|
8
|
-
|
9
8
|
/**
|
10
9
|
* @name layoutSection_full_node
|
11
10
|
*/
|
12
|
-
|
13
11
|
/**
|
14
12
|
* @stage 0
|
15
13
|
* @name layoutSection_with_single_column_node
|
16
14
|
*/
|
17
|
-
|
18
15
|
export var layoutSection = {
|
19
16
|
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
20
17
|
marks: 'unsupportedMark unsupportedNodeAttribute',
|
@@ -2,12 +2,15 @@
|
|
2
2
|
* @name mediaGroup_node
|
3
3
|
*/
|
4
4
|
|
5
|
+
// Temporary due to an existing issue in validator below:
|
6
|
+
// https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-1429
|
7
|
+
// TODO: Remove border and link marks from white list
|
5
8
|
export var mediaGroup = {
|
6
9
|
inline: false,
|
7
10
|
group: 'block',
|
8
11
|
content: '(media|unsupportedBlock)+',
|
9
12
|
attrs: {},
|
10
|
-
marks: 'unsupportedMark unsupportedNodeAttribute',
|
13
|
+
marks: 'unsupportedMark unsupportedNodeAttribute border link',
|
11
14
|
selectable: false,
|
12
15
|
parseDOM: [{
|
13
16
|
tag: 'div[data-node-type="mediaGroup"]'
|
@@ -38,7 +38,7 @@ export var mediaSingle = {
|
|
38
38
|
atom: true,
|
39
39
|
content: 'media|unsupportedBlock+|media unsupportedBlock+',
|
40
40
|
attrs: defaultAttrs,
|
41
|
-
marks: 'unsupportedMark unsupportedNodeAttribute link',
|
41
|
+
marks: 'unsupportedMark unsupportedNodeAttribute border link',
|
42
42
|
parseDOM: [{
|
43
43
|
tag: 'div[data-node-type="mediaSingle"]',
|
44
44
|
getAttrs: function getAttrs(dom) {
|
@@ -14,15 +14,12 @@
|
|
14
14
|
* type T1 = X | Y
|
15
15
|
* type T2 = A | T1 | B // T2 = A | X | Y | B
|
16
16
|
*/
|
17
|
-
|
18
17
|
/**
|
19
18
|
* @name paragraph_with_alignment_node
|
20
19
|
*/
|
21
|
-
|
22
20
|
/**
|
23
21
|
* @name paragraph_with_indentation_node
|
24
22
|
*/
|
25
|
-
|
26
23
|
var isImageNode = function isImageNode(node) {
|
27
24
|
return Boolean(node && node.nodeName.toLowerCase() === 'img');
|
28
25
|
};
|
@@ -117,6 +117,29 @@ export var tableBackgroundColorNames = new Map();
|
|
117
117
|
tableBackgroundColorPalette.set(colorValue.toLowerCase(), colorName);
|
118
118
|
tableBackgroundColorNames.set(colorName.toLowerCase(), colorValue.toLowerCase());
|
119
119
|
});
|
120
|
+
|
121
|
+
/**
|
122
|
+
* @name table_node
|
123
|
+
*/
|
124
|
+
|
125
|
+
/**
|
126
|
+
* @name table_row_node
|
127
|
+
*/
|
128
|
+
|
129
|
+
/**
|
130
|
+
* @name table_cell_content
|
131
|
+
* @minItems 1
|
132
|
+
* @allowUnsupportedBlock true
|
133
|
+
*/
|
134
|
+
|
135
|
+
/**
|
136
|
+
* @name table_cell_node
|
137
|
+
*/
|
138
|
+
|
139
|
+
/**
|
140
|
+
* @name table_header_node
|
141
|
+
*/
|
142
|
+
|
120
143
|
// TODO: Fix any, potential issue. ED-5048
|
121
144
|
var createTableSpec = function createTableSpec() {
|
122
145
|
var attrs = {
|