@atlaskit/adf-schema 20.1.3 → 22.0.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/cjs/json-schema/index.js +23 -0
  3. package/dist/cjs/schema/nodes/bodied-extension.js +1 -1
  4. package/dist/cjs/schema/nodes/doc.js +1 -1
  5. package/dist/cjs/schema/nodes/emoji.js +5 -5
  6. package/dist/cjs/schema/nodes/expand.js +1 -1
  7. package/dist/cjs/schema/nodes/layout-column.js +1 -1
  8. package/dist/cjs/schema/nodes/list-item.js +1 -1
  9. package/dist/cjs/schema/nodes/media-group.js +1 -1
  10. package/dist/cjs/schema/nodes/nested-expand.js +1 -1
  11. package/dist/cjs/schema/nodes/panel.js +10 -0
  12. package/dist/cjs/schema/nodes/paragraph.js +24 -145
  13. package/dist/cjs/schema/nodes/tableNodes.js +2 -2
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/json-schema/index.js +2 -0
  16. package/dist/es2019/schema/marks/data-consumer.js +8 -1
  17. package/dist/es2019/schema/nodes/bodied-extension.js +1 -1
  18. package/dist/es2019/schema/nodes/doc.js +1 -1
  19. package/dist/es2019/schema/nodes/emoji.js +5 -5
  20. package/dist/es2019/schema/nodes/expand.js +1 -1
  21. package/dist/es2019/schema/nodes/layout-column.js +1 -1
  22. package/dist/es2019/schema/nodes/list-item.js +1 -1
  23. package/dist/es2019/schema/nodes/media-group.js +1 -1
  24. package/dist/es2019/schema/nodes/nested-expand.js +1 -1
  25. package/dist/es2019/schema/nodes/panel.js +10 -0
  26. package/dist/es2019/schema/nodes/paragraph.js +24 -142
  27. package/dist/es2019/schema/nodes/tableNodes.js +2 -2
  28. package/dist/es2019/version.json +1 -1
  29. package/dist/esm/json-schema/index.js +2 -0
  30. package/dist/esm/schema/marks/data-consumer.js +8 -1
  31. package/dist/esm/schema/nodes/bodied-extension.js +1 -1
  32. package/dist/esm/schema/nodes/doc.js +1 -1
  33. package/dist/esm/schema/nodes/emoji.js +5 -5
  34. package/dist/esm/schema/nodes/expand.js +1 -1
  35. package/dist/esm/schema/nodes/layout-column.js +1 -1
  36. package/dist/esm/schema/nodes/list-item.js +1 -1
  37. package/dist/esm/schema/nodes/media-group.js +1 -1
  38. package/dist/esm/schema/nodes/nested-expand.js +1 -1
  39. package/dist/esm/schema/nodes/panel.js +10 -0
  40. package/dist/esm/schema/nodes/paragraph.js +24 -144
  41. package/dist/esm/schema/nodes/tableNodes.js +2 -2
  42. package/dist/esm/version.json +1 -1
  43. package/dist/json-schema/package.json +7 -0
  44. package/dist/json-schema/v1/full.json +67 -3
  45. package/dist/json-schema/v1/stage-0.json +36 -81
  46. package/dist/types/index.d.ts +1 -1
  47. package/dist/types/json-schema/index.d.ts +2 -0
  48. package/dist/types/schema/index.d.ts +1 -1
  49. package/dist/types/schema/marks/data-consumer.d.ts +8 -1
  50. package/dist/types/schema/marks/fragment.d.ts +0 -1
  51. package/dist/types/schema/nodes/bodied-extension.d.ts +1 -6
  52. package/dist/types/schema/nodes/extension.d.ts +1 -6
  53. package/dist/types/schema/nodes/index.d.ts +3 -3
  54. package/dist/types/schema/nodes/inline-extension.d.ts +1 -6
  55. package/dist/types/schema/nodes/panel.d.ts +2 -0
  56. package/dist/types/schema/nodes/tableNodes.d.ts +4 -2
  57. package/dist/types/schema/nodes/types/block-content.d.ts +3 -3
  58. package/dist/types/schema/nodes/types/inline-content.d.ts +3 -3
  59. package/dist/types/schema/nodes/types/non-nestable-block-content.d.ts +2 -2
  60. package/json-schema/package.json +7 -0
  61. package/json-schema/v1/full.json +67 -3
  62. package/json-schema/v1/stage-0.json +36 -81
  63. package/package.json +10 -3
  64. package/schema/package.json +7 -0
  65. package/url/package.json +7 -0
  66. package/test-helpers/html-helpers.ts +0 -40
  67. package/test-helpers/matches.ts +0 -8
  68. package/test-helpers/schema-builder.ts +0 -329
  69. package/test-helpers/schema.ts +0 -80
@@ -611,26 +611,14 @@
611
611
  "marks": {
612
612
  "type": "array",
613
613
  "items": {
614
- "$ref": "#/definitions/dataConsumer_mark"
615
- }
616
- }
617
- },
618
- "additionalProperties": true
619
- }
620
- ]
621
- },
622
- "inlineExtension_with_experimental_marks_node": {
623
- "allOf": [
624
- {
625
- "$ref": "#/definitions/inlineExtension_node"
626
- },
627
- {
628
- "type": "object",
629
- "properties": {
630
- "marks": {
631
- "type": "array",
632
- "items": {
633
- "$ref": "#/definitions/fragment_mark"
614
+ "anyOf": [
615
+ {
616
+ "$ref": "#/definitions/dataConsumer_mark"
617
+ },
618
+ {
619
+ "$ref": "#/definitions/fragment_mark"
620
+ }
621
+ ]
634
622
  }
635
623
  }
636
624
  },
@@ -1048,9 +1036,6 @@
1048
1036
  {
1049
1037
  "$ref": "#/definitions/inlineExtension_with_marks_node"
1050
1038
  },
1051
- {
1052
- "$ref": "#/definitions/inlineExtension_with_experimental_marks_node"
1053
- },
1054
1039
  {
1055
1040
  "$ref": "#/definitions/date_node"
1056
1041
  },
@@ -1534,6 +1519,12 @@
1534
1519
  "panelIcon": {
1535
1520
  "type": "string"
1536
1521
  },
1522
+ "panelIconId": {
1523
+ "type": "string"
1524
+ },
1525
+ "panelIconText": {
1526
+ "type": "string"
1527
+ },
1537
1528
  "panelColor": {
1538
1529
  "type": "string"
1539
1530
  }
@@ -1853,26 +1844,14 @@
1853
1844
  "marks": {
1854
1845
  "type": "array",
1855
1846
  "items": {
1856
- "$ref": "#/definitions/dataConsumer_mark"
1857
- }
1858
- }
1859
- },
1860
- "additionalProperties": true
1861
- }
1862
- ]
1863
- },
1864
- "extension_with_experimental_marks_node": {
1865
- "allOf": [
1866
- {
1867
- "$ref": "#/definitions/extension_node"
1868
- },
1869
- {
1870
- "type": "object",
1871
- "properties": {
1872
- "marks": {
1873
- "type": "array",
1874
- "items": {
1875
- "$ref": "#/definitions/fragment_mark"
1847
+ "anyOf": [
1848
+ {
1849
+ "$ref": "#/definitions/dataConsumer_mark"
1850
+ },
1851
+ {
1852
+ "$ref": "#/definitions/fragment_mark"
1853
+ }
1854
+ ]
1876
1855
  }
1877
1856
  }
1878
1857
  },
@@ -2032,6 +2011,12 @@
2032
2011
  "$ref": "#/definitions/table_row_node"
2033
2012
  },
2034
2013
  "minItems": 1
2014
+ },
2015
+ "marks": {
2016
+ "type": "array",
2017
+ "items": {
2018
+ "$ref": "#/definitions/fragment_mark"
2019
+ }
2035
2020
  }
2036
2021
  },
2037
2022
  "required": [
@@ -2126,9 +2111,6 @@
2126
2111
  {
2127
2112
  "$ref": "#/definitions/extension_with_marks_node"
2128
2113
  },
2129
- {
2130
- "$ref": "#/definitions/extension_with_experimental_marks_node"
2131
- },
2132
2114
  {
2133
2115
  "$ref": "#/definitions/embedCard_node"
2134
2116
  },
@@ -2264,9 +2246,6 @@
2264
2246
  {
2265
2247
  "$ref": "#/definitions/extension_with_marks_node"
2266
2248
  },
2267
- {
2268
- "$ref": "#/definitions/extension_with_experimental_marks_node"
2269
- },
2270
2249
  {
2271
2250
  "$ref": "#/definitions/embedCard_node"
2272
2251
  },
@@ -2416,26 +2395,14 @@
2416
2395
  "marks": {
2417
2396
  "type": "array",
2418
2397
  "items": {
2419
- "$ref": "#/definitions/dataConsumer_mark"
2420
- }
2421
- }
2422
- },
2423
- "additionalProperties": true
2424
- }
2425
- ]
2426
- },
2427
- "bodiedExtension_with_experimental_marks_node": {
2428
- "allOf": [
2429
- {
2430
- "$ref": "#/definitions/bodiedExtension_node"
2431
- },
2432
- {
2433
- "type": "object",
2434
- "properties": {
2435
- "marks": {
2436
- "type": "array",
2437
- "items": {
2438
- "$ref": "#/definitions/fragment_mark"
2398
+ "anyOf": [
2399
+ {
2400
+ "$ref": "#/definitions/dataConsumer_mark"
2401
+ },
2402
+ {
2403
+ "$ref": "#/definitions/fragment_mark"
2404
+ }
2405
+ ]
2439
2406
  }
2440
2407
  }
2441
2408
  },
@@ -2499,9 +2466,6 @@
2499
2466
  {
2500
2467
  "$ref": "#/definitions/extension_with_marks_node"
2501
2468
  },
2502
- {
2503
- "$ref": "#/definitions/extension_with_experimental_marks_node"
2504
- },
2505
2469
  {
2506
2470
  "$ref": "#/definitions/embedCard_node"
2507
2471
  },
@@ -2513,9 +2477,6 @@
2513
2477
  },
2514
2478
  {
2515
2479
  "$ref": "#/definitions/bodiedExtension_with_marks_node"
2516
- },
2517
- {
2518
- "$ref": "#/definitions/bodiedExtension_with_experimental_marks_node"
2519
2480
  }
2520
2481
  ]
2521
2482
  },
@@ -2732,9 +2693,6 @@
2732
2693
  {
2733
2694
  "$ref": "#/definitions/extension_with_marks_node"
2734
2695
  },
2735
- {
2736
- "$ref": "#/definitions/extension_with_experimental_marks_node"
2737
- },
2738
2696
  {
2739
2697
  "$ref": "#/definitions/embedCard_node"
2740
2698
  },
@@ -2750,9 +2708,6 @@
2750
2708
  {
2751
2709
  "$ref": "#/definitions/bodiedExtension_with_marks_node"
2752
2710
  },
2753
- {
2754
- "$ref": "#/definitions/bodiedExtension_with_experimental_marks_node"
2755
- },
2756
2711
  {
2757
2712
  "$ref": "#/definitions/layoutSection_full_node"
2758
2713
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "20.1.3",
3
+ "version": "22.0.1",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -16,10 +16,16 @@
16
16
  "atlaskit:src": "src/index.ts",
17
17
  "atlassian": {
18
18
  "team": "Editor",
19
- "deprecatedAutoEntryPoints": true,
20
19
  "inPublicMirror": true,
21
20
  "releaseModel": "scheduled"
22
21
  },
22
+ "af:exports": {
23
+ ".": "./src/index.ts",
24
+ "./steps": "./src/steps.ts",
25
+ "./schema": "./src/schema/index.ts",
26
+ "./json-schema": "./src/json-schema/index.ts",
27
+ "./url": "./src/utils/url.ts"
28
+ },
23
29
  "scripts": {
24
30
  "build:json-schema": "mkdir -p dist && cp -r json-schema dist",
25
31
  "generate:json-schema": "mkdir -p json-schema/v1/ && yarn generate:json-schema:full && yarn generate:json-schema:stage-0",
@@ -40,8 +46,9 @@
40
46
  "prosemirror-transform": "1.3.2"
41
47
  },
42
48
  "devDependencies": {
49
+ "@atlaskit/adf-utils": "^16.0.0",
43
50
  "@atlaskit/editor-json-transformer": "^8.7.0",
44
- "@atlaskit/editor-test-helpers": "^16.0.0",
51
+ "@atlaskit/editor-test-helpers": "^16.1.0",
45
52
  "@atlaskit/json-schema-generator": "^3.2.0",
46
53
  "@atlassian/adf-sample": "^1.0.0",
47
54
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/schema",
3
+ "main": "../dist/cjs/schema/index.js",
4
+ "module": "../dist/esm/schema/index.js",
5
+ "module:es2019": "../dist/es2019/schema/index.js",
6
+ "types": "../dist/types/schema/index.d.ts"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@atlaskit/adf-schema/url",
3
+ "main": "../dist/cjs/utils/url.js",
4
+ "module": "../dist/esm/utils/url.js",
5
+ "module:es2019": "../dist/es2019/utils/url.js",
6
+ "types": "../dist/types/utils/url.d.ts"
7
+ }
@@ -1,40 +0,0 @@
1
- import {
2
- DOMParser,
3
- DOMSerializer,
4
- Fragment,
5
- Schema,
6
- Node as PMNode,
7
- ParseOptions,
8
- } from 'prosemirror-model';
9
- import { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
10
- import { TextSelection } from 'prosemirror-state';
11
-
12
- export const fromHTML = (
13
- html: string,
14
- schema: Schema,
15
- options?: ParseOptions,
16
- ): PMNode => {
17
- const el = document.createElement('div');
18
- el.innerHTML = html;
19
-
20
- return DOMParser.fromSchema(schema).parse(el, options);
21
- };
22
-
23
- export const toDOM = (node: PMNode, schema: Schema): Node => {
24
- const serializer = DOMSerializer.fromSchema(schema);
25
- return serializer.serializeFragment(Fragment.from(node));
26
- };
27
-
28
- export const toContext = (node: DocBuilder, schema: Schema) => {
29
- const document = node(schema);
30
- const selection = TextSelection.near(
31
- document.resolve(document.refs['<>'] || 0),
32
- );
33
- return selection.$from;
34
- };
35
-
36
- export const toHTML = (node: PMNode, schema: Schema): string => {
37
- const el = document.createElement('div');
38
- el.appendChild(toDOM(node, schema));
39
- return el.innerHTML;
40
- };
@@ -1,8 +0,0 @@
1
- export default (text: string, regexp: RegExp) => {
2
- const results: RegExpExecArray[] = [];
3
- let match: RegExpExecArray | null;
4
- while ((match = regexp.exec(text))) {
5
- results.push(match);
6
- }
7
- return results;
8
- };
@@ -1,329 +0,0 @@
1
- import {
2
- Fragment,
3
- MarkType,
4
- Node,
5
- NodeType,
6
- Schema,
7
- Slice /*MediaAttributes */,
8
- } from 'prosemirror-model';
9
- import { MediaAttributes } from '../src/schema/nodes/media';
10
- import { MediaInlineAttributes } from '../src/schema/nodes/media-inline';
11
- import matches from './matches';
12
- import sampleSchema from './schema';
13
- import {
14
- TableAttributes,
15
- CellAttributes,
16
- } from '../src/schema/nodes/tableNodes';
17
-
18
- /**
19
- * Represents a ProseMirror "position" in a document.
20
- */
21
- export type position = number;
22
-
23
- /**
24
- * A useful feature of the builder is being able to declaratively mark positions
25
- * in content using the curly braces e.g. `{<>}`.
26
- *
27
- * These positions are called "refs" (inspired by React), and are tracked on
28
- * every node in the tree that has a ref on any of its descendants.
29
- */
30
- export type Refs = { [name: string]: position };
31
-
32
- /**
33
- * Content that contains refs information.
34
- */
35
- export type RefsContentItem = RefsNode | RefsTracker;
36
-
37
- /**
38
- * Content node or mark builders can consume, e.g.
39
- *
40
- * const builder = nodeFactory('p');
41
- * builder('string');
42
- * builder(aNode);
43
- * builder(aRefsNode);
44
- * builder(aRefsTracker);
45
- * builder([aNode, aRefsNode, aRefsTracker]);
46
- */
47
- export type BuilderContent =
48
- | string
49
- | Node
50
- | RefsContentItem
51
- | (Node | RefsContentItem)[];
52
-
53
- /**
54
- * ProseMirror doesn't support empty text nodes, which can be quite
55
- * inconvenient when you want to capture a position ref without introducing
56
- * text.
57
- *
58
- * Take a couple of examples:
59
- *
60
- * p('{<>}')
61
- * p('Hello ', '{<>}', 'world!')
62
- *
63
- * After the ref syntax is stripped you're left with:
64
- *
65
- * p('')
66
- * p('Hello ', '', 'world!')
67
- *
68
- * This violates the rule of text nodes being non-empty. This class solves the
69
- * problem by providing an alternative data structure that *only* stores refs,
70
- * and can be used in scenarios where an empty text would be forbidden.
71
- *
72
- * This is done under the hood when using `text()` factory, and instead of
73
- * always returning a text node, it'll instead return one of two things:
74
- *
75
- * - a text node -- when given a non-empty string
76
- * - a refs tracker -- when given a string that *only* contains refs.
77
- */
78
- export class RefsTracker {
79
- refs?: Refs;
80
- }
81
-
82
- /**
83
- * A standard ProseMirror Node that also tracks refs.
84
- */
85
- export interface RefsNode extends Node {
86
- refs: Refs;
87
- }
88
-
89
- /**
90
- * Create a text node.
91
- *
92
- * Special markers called "refs" can be put in the text. Refs provide a way to
93
- * declaratively describe a position within some text, and then access the
94
- * position in the resulting node.
95
- */
96
- export function text(value: string, schema: Schema): RefsContentItem {
97
- let stripped = '';
98
- let textIndex = 0;
99
- const refs: Refs = {};
100
-
101
- // Helpers
102
- const isEven = (n: number) => n % 2 === 0;
103
-
104
- for (const match of matches(value, /([\\]+)?{(\w+|<|>|<>)}/g)) {
105
- const [refToken, skipChars, refName] = match;
106
- let { index } = match;
107
-
108
- const skipLen = skipChars && skipChars.length;
109
- if (skipLen) {
110
- if (isEven(skipLen)) {
111
- index += skipLen / 2;
112
- } else {
113
- stripped += value.slice(textIndex, index + (skipLen - 1) / 2);
114
- stripped += value.slice(index + skipLen, index + refToken.length);
115
- textIndex = index + refToken.length;
116
- continue;
117
- }
118
- }
119
-
120
- stripped += value.slice(textIndex, index);
121
- refs[refName] = stripped.length;
122
- textIndex = match.index + refToken.length;
123
- }
124
-
125
- stripped += value.slice(textIndex);
126
-
127
- const node =
128
- stripped === '' ? new RefsTracker() : (schema.text(stripped) as RefsNode);
129
-
130
- node.refs = refs;
131
- return node;
132
- }
133
-
134
- /**
135
- * Offset ref position values by some amount.
136
- */
137
- export function offsetRefs(refs: Refs, offset: number): Refs {
138
- const result = {} as Refs;
139
- for (const name in refs) {
140
- result[name] = refs[name] + offset;
141
- }
142
- return result;
143
- }
144
-
145
- /**
146
- * Given a collection of nodes, sequence them in an array and return the result
147
- * along with the updated refs.
148
- */
149
- export function sequence(...content: RefsContentItem[]) {
150
- let position = 0;
151
- let refs = {} as Refs;
152
- const nodes = [] as RefsNode[];
153
-
154
- // It's bizarre that this is necessary. An if/else in the for...of should have
155
- // sufficient but it did not work at the time of writing.
156
- const isRefsTracker = (n: any): n is RefsTracker => n instanceof RefsTracker;
157
- const isRefsNode = (n: any): n is RefsNode => !isRefsTracker(n);
158
-
159
- for (const node of content) {
160
- if (isRefsTracker(node)) {
161
- refs = { ...refs, ...offsetRefs(node.refs!, position) };
162
- }
163
- if (isRefsNode(node)) {
164
- const thickness = node.isText ? 0 : 1;
165
- refs = { ...refs, ...offsetRefs(node.refs, position + thickness) };
166
- position += node.nodeSize;
167
- nodes.push(node as RefsNode);
168
- }
169
- }
170
- return { nodes, refs };
171
- }
172
-
173
- /**
174
- * Given a jagged array, flatten it down to a single level.
175
- */
176
- export function flatten<T>(deep: (T | T[])[]): T[] {
177
- const flat = [] as T[];
178
- for (const item of deep) {
179
- if (Array.isArray(item)) {
180
- flat.splice(flat.length, 0, ...item);
181
- } else {
182
- flat.push(item);
183
- }
184
- }
185
- return flat;
186
- }
187
-
188
- /**
189
- * Coerce builder content into ref nodes.
190
- */
191
- export function coerce(content: BuilderContent[], schema: Schema) {
192
- const refsContent = content.map((item) =>
193
- typeof item === 'string' ? text(item, schema) : item,
194
- ) as (RefsContentItem | RefsContentItem[])[];
195
- return sequence(...flatten<RefsContentItem>(refsContent));
196
- }
197
-
198
- /**
199
- * Create a factory for nodes.
200
- */
201
- export function nodeFactory(type: NodeType, attrs = {}) {
202
- return function (...content: BuilderContent[]): RefsNode {
203
- const { nodes, refs } = coerce(content, type.schema);
204
- const node = type.create(attrs, nodes) as RefsNode;
205
- node.refs = refs;
206
- return node;
207
- };
208
- }
209
-
210
- /**
211
- * Create a factory for marks.
212
- */
213
- export function markFactory(type: MarkType, attrs = {}) {
214
- const mark = type.create(attrs);
215
- return (...content: BuilderContent[]): RefsNode[] => {
216
- const { nodes } = coerce(content, type.schema);
217
- return nodes.map((node) => {
218
- if (mark.type.isInSet(node.marks)) {
219
- return node;
220
- } else {
221
- const refNode = node.mark(mark.addToSet(node.marks)) as RefsNode;
222
- refNode.refs = node.refs;
223
- return refNode;
224
- }
225
- });
226
- };
227
- }
228
-
229
- export const createCell = (colspan: number, rowspan: number) =>
230
- td({ colspan, rowspan })(p('x'));
231
- export const createHeaderCell = (colspan: number, rowspan: number) =>
232
- th({ colspan, rowspan })(p('x'));
233
-
234
- export const doc = nodeFactory(sampleSchema.nodes.doc, {});
235
- export const p = nodeFactory(sampleSchema.nodes.paragraph, {});
236
- export const blockquote = nodeFactory(sampleSchema.nodes.blockquote, {});
237
- export const h1 = nodeFactory(sampleSchema.nodes.heading, { level: 1 });
238
- export const h2 = nodeFactory(sampleSchema.nodes.heading, { level: 2 });
239
- export const h3 = nodeFactory(sampleSchema.nodes.heading, { level: 3 });
240
- export const h4 = nodeFactory(sampleSchema.nodes.heading, { level: 4 });
241
- export const h5 = nodeFactory(sampleSchema.nodes.heading, { level: 5 });
242
- export const h6 = nodeFactory(sampleSchema.nodes.heading, { level: 6 });
243
- export const li = nodeFactory(sampleSchema.nodes.listItem, {});
244
- export const ul = nodeFactory(sampleSchema.nodes.bulletList, {});
245
- export const ol = nodeFactory(sampleSchema.nodes.orderedList, {});
246
- export const br = sampleSchema.nodes.hardBreak.createChecked();
247
- export const extension = nodeFactory(sampleSchema.nodes.extension, {});
248
- export const panel = nodeFactory(sampleSchema.nodes.panel, {});
249
- export const panelNote = nodeFactory(sampleSchema.nodes.panel, {
250
- panelType: 'note',
251
- });
252
- export const plain = nodeFactory(sampleSchema.nodes.plain, {});
253
- export const hardBreak = nodeFactory(sampleSchema.nodes.hardBreak, {});
254
-
255
- export const code_block = (attrs: {} = {}) =>
256
- nodeFactory(sampleSchema.nodes.codeBlock, attrs);
257
- export const img = (attrs: { src: string; alt?: string; title?: string }) =>
258
- sampleSchema.nodes.image.createChecked(attrs);
259
- export const emoji = (attrs: {
260
- shortName: string;
261
- id?: string;
262
- fallback?: string;
263
- }) => {
264
- const emojiNodeAttrs = {
265
- shortName: attrs.shortName,
266
- id: attrs.id,
267
- text: attrs.fallback || attrs.shortName,
268
- };
269
- return sampleSchema.nodes.emoji.createChecked(emojiNodeAttrs);
270
- };
271
- export const mention = (attrs: { id: string; text?: string }) =>
272
- sampleSchema.nodes.mention.createChecked(attrs);
273
- export const hr = sampleSchema.nodes.rule.createChecked();
274
- export const em = markFactory(sampleSchema.marks.em, {});
275
- export const subsup = (attrs: { type: string }) =>
276
- markFactory(sampleSchema.marks.subsup, attrs);
277
- export const underline = markFactory(sampleSchema.marks.underline, {});
278
- export const strong = markFactory(sampleSchema.marks.strong, {});
279
- export const code = markFactory(sampleSchema.marks.code, {});
280
- export const strike = markFactory(sampleSchema.marks.strike, {});
281
- export const mentionQuery = (attrs = { active: true }) =>
282
- markFactory(sampleSchema.marks.mentionQuery, attrs ? attrs : {});
283
- export const a = (attrs: { href: string; title?: string }) =>
284
- markFactory(sampleSchema.marks.link, attrs);
285
- export const fragment = (...content: BuilderContent[]) =>
286
- flatten<BuilderContent>(content);
287
- export const slice = (...content: BuilderContent[]) =>
288
- new Slice(Fragment.from(coerce(content, sampleSchema).nodes), 0, 0);
289
- export const mediaSingle = (attrs = {}) =>
290
- nodeFactory(sampleSchema.nodes.mediaSingle, attrs);
291
- export const mediaGroup = nodeFactory(sampleSchema.nodes.mediaGroup);
292
- export const mediaInline = (attrs: MediaInlineAttributes) =>
293
- sampleSchema.nodes.media.create(attrs);
294
- export const media = (attrs: MediaAttributes) =>
295
- sampleSchema.nodes.media.create(attrs);
296
- export const textColor = (attrs: { color: string }) =>
297
- markFactory(sampleSchema.marks.textColor, attrs);
298
- export const table = (attrs?: TableAttributes) =>
299
- nodeFactory(sampleSchema.nodes.table, attrs);
300
- export const tr = nodeFactory(sampleSchema.nodes.tableRow, {});
301
- export const td = (attrs: CellAttributes) =>
302
- nodeFactory(sampleSchema.nodes.tableCell, attrs);
303
- export const th = (attrs: CellAttributes) =>
304
- nodeFactory(sampleSchema.nodes.tableHeader, attrs);
305
- export const tdEmpty = td({})(p(''));
306
- export const thEmpty = th({})(p(''));
307
- export const tdCursor = td({})(p('{<>}'));
308
- export const thCursor = th({})(p('{<>}'));
309
- export const td11 = createCell(1, 1);
310
- export const th11 = createHeaderCell(1, 1);
311
- export const decisionList = nodeFactory(sampleSchema.nodes.decisionList, {});
312
- export const decisionItem = nodeFactory(sampleSchema.nodes.decisionItem, {});
313
- export const taskList = nodeFactory(sampleSchema.nodes.taskList, {});
314
- export const taskItem = nodeFactory(sampleSchema.nodes.taskItem, {});
315
- export const confluenceUnsupportedBlock = (cxhtml: string) =>
316
- nodeFactory(sampleSchema.nodes.confluenceUnsupportedBlock, { cxhtml })();
317
- export const confluenceUnsupportedInline = (cxhtml: string) =>
318
- nodeFactory(sampleSchema.nodes.confluenceUnsupportedInline, { cxhtml })();
319
- export const confluenceJiraIssue = (attrs: {
320
- issueKey?: string;
321
- macroId?: string;
322
- schemaVersion?: string;
323
- server?: string;
324
- serverId?: string;
325
- }) => sampleSchema.nodes.confluenceJiraIssue.create(attrs);
326
- export const unsupportedBlock = (originalValue: object) =>
327
- nodeFactory(sampleSchema.nodes.unsupportedBlock, { originalValue })();
328
- export const unsupportedInline = (originalValue: object) =>
329
- nodeFactory(sampleSchema.nodes.unsupportedInline, { originalValue })();