@progress/kendo-editor-common 1.12.2-develop.5 → 1.12.2-develop.6

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 (183) hide show
  1. package/dist/cdn/js/kendo-editor-common.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/DOMSerializer.js +6 -7
  4. package/dist/es/align.js +3 -6
  5. package/dist/es/blockNode.js +11 -14
  6. package/dist/es/blockquote.js +2 -5
  7. package/dist/es/cleanFormatting.js +3 -6
  8. package/dist/es/config/align-rules.js +5 -7
  9. package/dist/es/config/commands.js +13 -9
  10. package/dist/es/config/constants.js +7 -9
  11. package/dist/es/config/indent-rules.js +3 -6
  12. package/dist/es/config/keymap.js +7 -10
  13. package/dist/es/config/list-settings.js +3 -5
  14. package/dist/es/config/schema.js +4 -6
  15. package/dist/es/find-replace.js +8 -10
  16. package/dist/es/flatten-spans.js +2 -5
  17. package/dist/es/image.js +2 -5
  18. package/dist/es/indent.js +11 -14
  19. package/dist/es/inline-style.js +10 -12
  20. package/dist/es/link.js +5 -8
  21. package/dist/es/listConvert.js +8 -9
  22. package/dist/es/lists.js +12 -15
  23. package/dist/es/main.js +34 -33
  24. package/dist/es/mark.js +16 -17
  25. package/dist/es/paste.js +10 -13
  26. package/dist/es/plugins/caret-color.js +5 -8
  27. package/dist/es/plugins/csp-fix.js +2 -5
  28. package/dist/es/plugins/highlight.js +3 -6
  29. package/dist/es/plugins/image-resize.js +8 -11
  30. package/dist/es/plugins/list-markers-styles.js +2 -5
  31. package/dist/es/plugins/placeholder.js +2 -5
  32. package/dist/es/plugins/resize-utils.js +2 -4
  33. package/dist/es/plugins/spaces-fix.js +1 -4
  34. package/dist/es/plugins/table-resize/column-resize.js +21 -24
  35. package/dist/es/plugins/table-resize/index.js +6 -9
  36. package/dist/es/plugins/table-resize/row-resize.js +23 -24
  37. package/dist/es/plugins/table-resize/table-resize.js +17 -20
  38. package/dist/es/plugins/table-resize/table-view.js +6 -9
  39. package/dist/es/plugins/table-resize/utils.js +10 -13
  40. package/dist/es/source.js +15 -18
  41. package/dist/es/table.js +15 -18
  42. package/dist/es/text.js +1 -3
  43. package/dist/es/types/active-marks.js +1 -0
  44. package/dist/es/types/command.js +1 -0
  45. package/dist/es/types/dispatchFn.js +1 -0
  46. package/dist/es/types/paste-cleanup-settings.js +1 -0
  47. package/dist/es/types/predicate.js +1 -0
  48. package/dist/es/utils.js +18 -21
  49. package/dist/npm/DOMSerializer.d.ts +35 -0
  50. package/dist/npm/DOMSerializer.js +10 -9
  51. package/dist/npm/align.d.ts +4 -7
  52. package/dist/npm/align.js +9 -10
  53. package/dist/npm/blockNode.d.ts +15 -12
  54. package/dist/npm/blockNode.js +28 -29
  55. package/dist/npm/blockquote.d.ts +2 -5
  56. package/dist/npm/blockquote.js +6 -7
  57. package/dist/npm/cleanFormatting.d.ts +3 -6
  58. package/dist/npm/cleanFormatting.js +7 -8
  59. package/dist/npm/config/align-rules.d.ts +6 -8
  60. package/dist/npm/config/align-rules.js +8 -13
  61. package/dist/npm/config/commands.d.ts +19 -11
  62. package/dist/npm/config/commands.js +16 -17
  63. package/dist/npm/config/constants.d.ts +7 -0
  64. package/dist/npm/config/constants.js +10 -17
  65. package/dist/npm/config/indent-rules.d.ts +4 -6
  66. package/dist/npm/config/indent-rules.js +8 -11
  67. package/dist/npm/config/keymap.d.ts +2 -5
  68. package/dist/npm/config/keymap.js +21 -22
  69. package/dist/npm/config/list-settings.d.ts +30 -0
  70. package/dist/npm/config/list-settings.js +10 -13
  71. package/dist/npm/config/schema.d.ts +2 -3
  72. package/dist/npm/config/schema.js +19 -20
  73. package/dist/npm/find-replace.d.ts +7 -10
  74. package/dist/npm/find-replace.js +20 -20
  75. package/dist/npm/flatten-spans.d.ts +1 -3
  76. package/dist/npm/flatten-spans.js +6 -7
  77. package/dist/npm/image.d.ts +3 -6
  78. package/dist/npm/image.js +5 -6
  79. package/dist/npm/indent.d.ts +9 -12
  80. package/dist/npm/indent.js +37 -38
  81. package/dist/npm/inline-style.d.ts +4 -7
  82. package/dist/npm/inline-style.js +28 -28
  83. package/dist/npm/link.d.ts +2 -4
  84. package/dist/npm/link.js +21 -22
  85. package/dist/npm/listConvert.d.ts +1 -3
  86. package/dist/npm/listConvert.js +13 -12
  87. package/dist/npm/lists.d.ts +8 -8
  88. package/dist/npm/lists.js +26 -27
  89. package/dist/npm/main.d.ts +34 -35
  90. package/dist/npm/main.js +214 -391
  91. package/dist/npm/mark.d.ts +17 -12
  92. package/dist/npm/mark.js +30 -29
  93. package/dist/npm/paste.d.ts +8 -11
  94. package/dist/npm/paste.js +19 -20
  95. package/dist/npm/plugins/caret-color.d.ts +2 -5
  96. package/dist/npm/plugins/caret-color.js +15 -17
  97. package/dist/npm/plugins/csp-fix.d.ts +1 -4
  98. package/dist/npm/plugins/csp-fix.js +8 -9
  99. package/dist/npm/plugins/highlight.d.ts +4 -7
  100. package/dist/npm/plugins/highlight.js +11 -13
  101. package/dist/npm/plugins/image-resize.d.ts +5 -7
  102. package/dist/npm/plugins/image-resize.js +35 -37
  103. package/dist/npm/plugins/list-markers-styles.d.ts +2 -5
  104. package/dist/npm/plugins/list-markers-styles.js +14 -16
  105. package/dist/npm/plugins/placeholder.d.ts +1 -4
  106. package/dist/npm/plugins/placeholder.js +10 -12
  107. package/dist/npm/plugins/resize-utils.d.ts +35 -0
  108. package/dist/npm/plugins/resize-utils.js +5 -7
  109. package/dist/npm/plugins/spaces-fix.d.ts +1 -4
  110. package/dist/npm/plugins/spaces-fix.js +9 -10
  111. package/dist/npm/plugins/table-resize/column-resize.d.ts +2 -0
  112. package/dist/npm/plugins/table-resize/column-resize.js +44 -46
  113. package/dist/npm/plugins/table-resize/index.d.ts +2 -5
  114. package/dist/npm/plugins/table-resize/index.js +13 -14
  115. package/dist/npm/plugins/table-resize/row-resize.d.ts +2 -0
  116. package/dist/npm/plugins/table-resize/row-resize.js +40 -40
  117. package/dist/npm/plugins/table-resize/table-resize.d.ts +18 -0
  118. package/dist/npm/plugins/table-resize/table-resize.js +51 -52
  119. package/dist/npm/plugins/table-resize/table-view.d.ts +28 -0
  120. package/dist/npm/plugins/table-resize/table-view.js +23 -24
  121. package/dist/npm/plugins/table-resize/utils.d.ts +17 -7
  122. package/dist/npm/plugins/table-resize/utils.js +24 -28
  123. package/dist/npm/source.d.ts +13 -16
  124. package/dist/npm/source.js +35 -36
  125. package/dist/npm/table.d.ts +9 -10
  126. package/dist/npm/table.js +33 -49
  127. package/dist/npm/text.d.ts +3 -6
  128. package/dist/npm/text.js +3 -3
  129. package/dist/npm/types/active-marks.d.ts +1 -4
  130. package/dist/npm/types/active-marks.js +2 -0
  131. package/dist/npm/types/command.d.ts +2 -5
  132. package/dist/npm/types/command.js +2 -0
  133. package/dist/npm/types/dispatchFn.d.ts +1 -4
  134. package/dist/npm/types/dispatchFn.js +2 -0
  135. package/dist/npm/types/paste-cleanup-settings.d.ts +1 -3
  136. package/dist/npm/types/paste-cleanup-settings.js +2 -0
  137. package/dist/npm/types/predicate.d.ts +1 -0
  138. package/dist/npm/types/predicate.js +2 -0
  139. package/dist/npm/utils.d.ts +33 -14
  140. package/dist/npm/utils.js +38 -39
  141. package/package.json +3 -50
  142. package/dist/es2015/DOMSerializer.js +0 -184
  143. package/dist/es2015/align.js +0 -43
  144. package/dist/es2015/blockNode.js +0 -180
  145. package/dist/es2015/blockquote.js +0 -26
  146. package/dist/es2015/cleanFormatting.js +0 -20
  147. package/dist/es2015/config/align-rules.js +0 -30
  148. package/dist/es2015/config/commands.js +0 -50
  149. package/dist/es2015/config/constants.js +0 -9
  150. package/dist/es2015/config/indent-rules.js +0 -42
  151. package/dist/es2015/config/keymap.js +0 -51
  152. package/dist/es2015/config/list-settings.js +0 -21
  153. package/dist/es2015/config/schema.js +0 -314
  154. package/dist/es2015/find-replace.js +0 -122
  155. package/dist/es2015/flatten-spans.js +0 -112
  156. package/dist/es2015/image.js +0 -10
  157. package/dist/es2015/indent.js +0 -105
  158. package/dist/es2015/inline-style.js +0 -177
  159. package/dist/es2015/link.js +0 -105
  160. package/dist/es2015/listConvert.js +0 -184
  161. package/dist/es2015/lists.js +0 -266
  162. package/dist/es2015/main.js +0 -44
  163. package/dist/es2015/mark.js +0 -239
  164. package/dist/es2015/node_modules/tslib/tslib.es6.js +0 -35
  165. package/dist/es2015/paste.js +0 -162
  166. package/dist/es2015/plugins/caret-color.js +0 -34
  167. package/dist/es2015/plugins/csp-fix.js +0 -51
  168. package/dist/es2015/plugins/highlight.js +0 -23
  169. package/dist/es2015/plugins/image-resize.js +0 -225
  170. package/dist/es2015/plugins/list-markers-styles.js +0 -104
  171. package/dist/es2015/plugins/placeholder.js +0 -27
  172. package/dist/es2015/plugins/resize-utils.js +0 -13
  173. package/dist/es2015/plugins/spaces-fix.js +0 -46
  174. package/dist/es2015/plugins/table-resize/column-resize.js +0 -267
  175. package/dist/es2015/plugins/table-resize/index.js +0 -12
  176. package/dist/es2015/plugins/table-resize/row-resize.js +0 -234
  177. package/dist/es2015/plugins/table-resize/table-resize.js +0 -278
  178. package/dist/es2015/plugins/table-resize/table-view.js +0 -128
  179. package/dist/es2015/plugins/table-resize/utils.js +0 -93
  180. package/dist/es2015/source.js +0 -251
  181. package/dist/es2015/table.js +0 -132
  182. package/dist/es2015/text.js +0 -5
  183. package/dist/es2015/utils.js +0 -289
@@ -1,180 +0,0 @@
1
- import { __rest } from './node_modules/tslib/tslib.es6.js';
2
- import { changeStylesString } from './utils.js';
3
- import { ReplaceAroundStep } from 'prosemirror-transform';
4
- import { Slice, Fragment } from 'prosemirror-model';
5
- import { NodeSelection } from 'prosemirror-state';
6
-
7
- /**
8
- * @hidden
9
- */
10
- const canChangeType = (stateDoc, pos, type) => {
11
- const $pos = stateDoc.resolve(pos), index = $pos.index();
12
- return $pos.parent.canReplaceWith(index, index + 1, type);
13
- };
14
- /**
15
- * Changes the type or the attributes of the passed node.
16
- *
17
- * @example
18
- * See `cleanTextBlockFormatting` or `formatBlockElements` function.
19
- */
20
- const changeTextBlock = (tr, node, nodeType, attrs) => {
21
- if (!nodeType.isTextblock) {
22
- return false;
23
- }
24
- const { ranges } = tr.selection;
25
- ranges.forEach(range => {
26
- const mapFrom = tr.steps.length;
27
- const from = range.$from.pos;
28
- const to = range.$to.pos;
29
- tr.doc.nodesBetween(from, to, (currNode, pos) => {
30
- if (currNode.eq(node) &&
31
- currNode.isTextblock &&
32
- !currNode.hasMarkup(nodeType, attrs) &&
33
- canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), nodeType)) {
34
- // Ensure all markup that isn't allowed in the new node type is cleared
35
- tr.clearIncompatible(tr.mapping.slice(mapFrom).map(pos, 1), nodeType);
36
- const mapping = tr.mapping.slice(mapFrom);
37
- const startM = mapping.map(pos, 1), endM = mapping.map(pos + currNode.nodeSize, 1);
38
- const slice = new Slice(Fragment.from(nodeType.create(attrs, null, currNode.marks)), 0, 0);
39
- tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, slice, 1, true));
40
- return false; // this will skip the node children
41
- }
42
- });
43
- });
44
- };
45
- /**
46
- * Traverses the selection and returns the block nodes in it.
47
- *
48
- * @example
49
- * See `cleanTextBlockFormatting` function.
50
- */
51
- const blockNodes = (state, options = { blocksInSelection: false }) => {
52
- const { doc, selection } = state;
53
- const { $from, ranges } = selection;
54
- const { blocksInSelection } = options;
55
- const result = [];
56
- const selNode = selection instanceof NodeSelection ? selection.node : undefined;
57
- if (selNode) {
58
- if (selNode.isBlock) {
59
- result.push(selNode);
60
- selNode.nodesBetween(0, selNode.content.size, node => {
61
- if (node.isBlock) {
62
- result.push(node);
63
- }
64
- });
65
- }
66
- else if (!blocksInSelection && $from.parent && $from.parent.isBlock) {
67
- result.push($from.parent);
68
- }
69
- }
70
- else {
71
- ranges.forEach(range => {
72
- const from = range.$from.pos;
73
- const to = range.$to.pos;
74
- doc.nodesBetween(from, to, (node, pos) => {
75
- if (node.isBlock && (!blocksInSelection || (pos >= from && pos + node.content.size + 2 <= to))) {
76
- result.push(node);
77
- }
78
- });
79
- });
80
- }
81
- return result;
82
- };
83
- const formatBlockElements = (value, commandName) => (state, dispatch) => {
84
- const blocks = blockNodes(state);
85
- const nodes = state.schema.nodes;
86
- const tr = state.tr;
87
- tr.setMeta('commandName', commandName);
88
- tr.setMeta('args', { value });
89
- blocks.forEach(node => {
90
- if (node.type.isTextblock) {
91
- if (value === 'p') {
92
- changeTextBlock(tr, node, nodes.paragraph, node.attrs);
93
- }
94
- else if (/^h[1-6]$/i.test(value)) {
95
- const level = parseInt(value.substr(1), 10);
96
- changeTextBlock(tr, node, nodes.heading, Object.assign(Object.assign({}, node.attrs), { level }));
97
- }
98
- else if (value === 'blockquote') {
99
- changeTextBlock(tr, node, nodes.blockquote, node.attrs);
100
- }
101
- }
102
- });
103
- const result = tr.docChanged;
104
- if (result) {
105
- dispatch(tr.scrollIntoView());
106
- }
107
- return result;
108
- };
109
- /**
110
- * Removes the style and class attributes of text block elements.
111
- * Requires to dispatch the transaction.
112
- *
113
- * @example
114
- * See `cleanFormatting` function.
115
- */
116
- const cleanTextBlockFormatting = (tr, options = { blocksInSelection: true }) => {
117
- const { doc, selection } = tr;
118
- const { blocksInSelection, blockNodeType } = options;
119
- const nodes = blockNodes({ doc, selection }, { blocksInSelection });
120
- const textBlocks = nodes.filter(node => node.isTextblock);
121
- textBlocks.forEach(node => {
122
- const _a = node.attrs || {}, { style = '', class: className = '' } = _a, attrs = __rest(_a, ["style", "class"]);
123
- const nodeType = blockNodeType || node.type;
124
- if (style || className || nodeType !== node.type) {
125
- changeTextBlock(tr, node, nodeType, attrs);
126
- }
127
- });
128
- };
129
- const getBlockFormats = (state) => {
130
- const blocks = blockNodes(state);
131
- const nodes = state.schema.nodes;
132
- const result = [];
133
- blocks.forEach((node) => {
134
- if (node.type === nodes.paragraph) {
135
- result.push('p');
136
- }
137
- else if (node.type === nodes.heading) {
138
- result.push(`h${node.attrs.level}`);
139
- }
140
- else if (node.type === nodes.blockquote && nodes.blockquote.isTextblock) {
141
- // In case the blockquote can have inline content.
142
- result.push('blockquote');
143
- }
144
- });
145
- return result;
146
- };
147
- const addStyles = (node, stylesToApply) => {
148
- let currentStyles = node.attrs.style, changedStyleResult, toChange;
149
- if (currentStyles) {
150
- stylesToApply.forEach(style => {
151
- toChange = { style: style.name, value: /^.+$/, newValue: style.value };
152
- changedStyleResult = changeStylesString(currentStyles, toChange);
153
- currentStyles = changedStyleResult.changed ? changedStyleResult.style : currentStyles;
154
- });
155
- }
156
- const reducer = (acc, curr) => ((acc && curr.value ? acc + ' ' : '') + curr.value ? `${curr.name}: ${curr.value};` : '');
157
- currentStyles = currentStyles || stylesToApply.reduce(reducer, '');
158
- return Object.assign({}, node.attrs, { style: currentStyles || null });
159
- };
160
- const hasNode = (state, nodeType) => {
161
- const { from, to } = state.selection;
162
- let result = false;
163
- state.doc.nodesBetween(from, to, node => {
164
- result = result || node.type === nodeType;
165
- return !result;
166
- });
167
- return result;
168
- };
169
- const parentBlockFormat = (state) => {
170
- const formats = getBlockFormats(state);
171
- return new Set(formats).size === 1 ? formats[0] : null;
172
- };
173
- /**
174
- * **Deprecated.** Use `parentBlockFormat` function instead.
175
- */
176
- const activeNode = (state) => {
177
- return { tag: parentBlockFormat(state) || '' };
178
- };
179
-
180
- export { activeNode, addStyles, blockNodes, changeTextBlock, cleanTextBlockFormatting, formatBlockElements, getBlockFormats, hasNode, parentBlockFormat };
@@ -1,26 +0,0 @@
1
- import { wrapIn } from 'prosemirror-commands';
2
-
3
- const blockquote = (state, dispatch) => {
4
- return wrapIn(state.schema.nodes.blockquote)(state, dispatch);
5
- };
6
- const liftBlockquote = (state, dispatch) => {
7
- const { $from, $to } = state.selection;
8
- const nodeType = state.schema.nodes.blockquote;
9
- const doc = state.doc;
10
- let target = -1;
11
- const range = $from.blockRange($to);
12
- if (range) {
13
- doc.nodesBetween(range.start, range.end, (node, pos) => {
14
- if (node.type === nodeType) {
15
- target = pos;
16
- }
17
- });
18
- }
19
- const result = target !== -1;
20
- if (dispatch && result) {
21
- dispatch(state.tr.lift(range, doc.resolve(target).depth));
22
- }
23
- return result;
24
- };
25
-
26
- export { blockquote, liftBlockquote };
@@ -1,20 +0,0 @@
1
- import { cleanTextBlockFormatting } from './blockNode.js';
2
- import { cleanMarks } from './mark.js';
3
-
4
- /**
5
- * A command which removes the inline formatting, class and style attributes of paragraph and heading elements in the selection.
6
- */
7
- const cleanFormatting = (options = { blocksInSelection: true }) => (state, dispatch) => {
8
- const tr = state.tr;
9
- const { blocksInSelection, blockNodeType, exceptMarks } = options;
10
- const except = (exceptMarks || [state.schema.marks.link]).filter(Boolean);
11
- cleanMarks(tr, { except });
12
- cleanTextBlockFormatting(tr, { blocksInSelection, blockNodeType });
13
- const result = tr.docChanged;
14
- if (result && dispatch) {
15
- dispatch(tr);
16
- }
17
- return result;
18
- };
19
-
20
- export { cleanFormatting };
@@ -1,30 +0,0 @@
1
- const style = (name, value) => {
2
- return { name: name, value: value };
3
- };
4
- const alignLeftRules = [
5
- { node: 'paragraph', style: [style('text-align', 'left')] },
6
- { node: 'heading', style: [style('text-align', 'left')] },
7
- { node: 'table_caption_external', style: [style('text-align', 'left')] }
8
- ];
9
- const alignRightRules = [
10
- { node: 'paragraph', style: [style('text-align', 'right')] },
11
- { node: 'heading', style: [style('text-align', 'right')] },
12
- { node: 'table_caption_external', style: [style('text-align', 'right')] }
13
- ];
14
- const alignCenterRules = [
15
- { node: 'paragraph', style: [style('text-align', 'center')] },
16
- { node: 'heading', style: [style('text-align', 'center')] },
17
- { node: 'table_caption_external', style: [style('text-align', 'center')] }
18
- ];
19
- const alignJustifyRules = [
20
- { node: 'paragraph', style: [style('text-align', 'justify')] },
21
- { node: 'heading', style: [style('text-align', 'justify')] },
22
- { node: 'table_caption_external', style: [style('text-align', 'justify')] }
23
- ];
24
- const alignRemoveRules = [
25
- { node: 'paragraph', style: [style('text-align', '')] },
26
- { node: 'heading', style: [style('text-align', '')] },
27
- { node: 'table_caption_external', style: [style('text-align', '')] }
28
- ];
29
-
30
- export { alignCenterRules, alignJustifyRules, alignLeftRules, alignRemoveRules, alignRightRules };
@@ -1,50 +0,0 @@
1
- /**
2
- * The object of the Bold command.
3
- */
4
- const bold = {
5
- mark: 'strong',
6
- altMarks: ['b'],
7
- altStyle: { name: 'font-weight', value: /^(bold(er)?|[5-9]\d{2,})$/ }
8
- };
9
- /**
10
- * The object of the Italic command.
11
- */
12
- const italic = {
13
- mark: 'em',
14
- altMarks: ['i'],
15
- altStyle: { name: 'font-style', value: /^italic$/i }
16
- };
17
- /**
18
- * The object of the Underline command.
19
- */
20
- const underline = {
21
- mark: 'u',
22
- altStyle: { name: 'text-decoration', value: /^underline$/i }
23
- };
24
- /**
25
- * The object of the Strikethrough command.
26
- */
27
- const strikethrough = {
28
- mark: 'del',
29
- altStyle: { name: 'text-decoration', value: /^line-through$/i }
30
- };
31
- /**
32
- * The object of the Subscript command.
33
- */
34
- const subscript = {
35
- mark: 'sub'
36
- };
37
- /**
38
- * The object of the Superscript command.
39
- */
40
- const superscript = {
41
- mark: 'sup'
42
- };
43
- /**
44
- * The object of the Link tool settings.
45
- */
46
- const link = {
47
- mark: 'link'
48
- };
49
-
50
- export { bold, italic, link, strikethrough, subscript, superscript, underline };
@@ -1,9 +0,0 @@
1
- const rowTypeAttr = 'k-parent-node';
2
- const colgroupAttr = 'k-colgroup-data';
3
- const resizableAttr = 'k-resizable-node';
4
- const resizableWrap = 'k-editor-resize-wrap-element';
5
- const resizeHandle = 'k-editor-resize-handle';
6
- const dataResizeDirTable = 'data-dir-table-resize';
7
- const dataResizeDirImage = 'data-dir-image-resize';
8
-
9
- export { colgroupAttr, dataResizeDirImage, dataResizeDirTable, resizableAttr, resizableWrap, resizeHandle, rowTypeAttr };
@@ -1,42 +0,0 @@
1
- import { listsTypes } from './list-settings.js';
2
-
3
- /**
4
- * The object of the Indent tool settings.
5
- */
6
- const indentRules = {
7
- nodes: [{
8
- node: 'paragraph',
9
- style: 'margin-left',
10
- rtlStyle: 'margin-right',
11
- step: 30,
12
- unit: 'px'
13
- }, {
14
- node: 'heading',
15
- style: 'margin-left',
16
- rtlStyle: 'margin-right',
17
- step: 30,
18
- unit: 'px'
19
- }],
20
- listsTypes: Object.assign({}, listsTypes)
21
- };
22
- /**
23
- * The object of the Outdent tool settings.
24
- */
25
- const outdentRules = {
26
- nodes: [{
27
- node: 'paragraph',
28
- style: 'margin-left',
29
- rtlStyle: 'margin-right',
30
- step: -30,
31
- unit: 'px'
32
- }, {
33
- node: 'heading',
34
- style: 'margin-left',
35
- rtlStyle: 'margin-right',
36
- step: -30,
37
- unit: 'px'
38
- }],
39
- listsTypes: Object.assign({}, listsTypes)
40
- };
41
-
42
- export { indentRules, outdentRules };
@@ -1,51 +0,0 @@
1
- import { chainCommands, deleteSelection, joinBackward, selectNodeBackward, newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks, exitCode } from 'prosemirror-commands';
2
- import { undo, redo } from 'prosemirror-history';
3
- import { undoInputRule } from 'prosemirror-inputrules';
4
- import { splitListItemKeepMarks } from '../lists.js';
5
- import { bold, italic, underline } from './commands.js';
6
- import { toggleInlineFormat } from '../inline-style.js';
7
- import { expandToWordWrap } from '../utils.js';
8
-
9
- const mac = typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;
10
- // https://github.com/ProseMirror/prosemirror-example-setup/blob/master/src/keymap.js
11
- const buildKeymap = (schema, options) => {
12
- const keys = {};
13
- const applyToWord = (options && options.applyToWord) || false;
14
- keys['Mod-z'] = undo;
15
- keys['Shift-Mod-z'] = redo;
16
- // tslint:disable-next-line:no-string-literal
17
- keys.Backspace = chainCommands(undoInputRule, deleteSelection, joinBackward, selectNodeBackward);
18
- // tslint:disable-next-line:no-string-literal
19
- keys.Enter = chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlockKeepMarks);
20
- if (!mac) {
21
- keys['Mod-y'] = redo;
22
- }
23
- if (schema.marks.strong) {
24
- keys['Mod-b'] = expandToWordWrap(toggleInlineFormat, Object.assign(Object.assign({}, bold), { applyToWord }));
25
- }
26
- if (schema.marks.em) {
27
- keys['Mod-i'] = expandToWordWrap(toggleInlineFormat, Object.assign(Object.assign({}, italic), { applyToWord }));
28
- }
29
- if (schema.marks.u) {
30
- keys['Mod-u'] = expandToWordWrap(toggleInlineFormat, Object.assign(Object.assign({}, underline), { applyToWord }));
31
- }
32
- if (schema.nodes.hard_break) {
33
- const br = schema.nodes.hard_break;
34
- const cmd = chainCommands(exitCode, (state, dispatch) => {
35
- dispatch(state.tr.replaceSelectionWith(br.create()).scrollIntoView());
36
- return true;
37
- });
38
- keys['Shift-Enter'] = cmd;
39
- }
40
- return keys;
41
- };
42
- const buildListKeymap = (schema) => {
43
- const keys = {};
44
- if (schema.nodes.list_item) {
45
- // tslint:disable-next-line:no-string-literal
46
- keys.Enter = splitListItemKeepMarks(schema.nodes.list_item);
47
- }
48
- return keys;
49
- };
50
-
51
- export { buildKeymap, buildListKeymap };
@@ -1,21 +0,0 @@
1
- const listsTypes = {
2
- orderedList: 'ordered_list',
3
- bulletList: 'bullet_list',
4
- listItem: 'list_item'
5
- };
6
- /**
7
- * The object of the OrderedList tool settings.
8
- */
9
- const orderedList = {
10
- listType: listsTypes.orderedList,
11
- types: Object.assign({}, listsTypes)
12
- };
13
- /**
14
- * The object of the UnorderedList tool settings.
15
- */
16
- const bulletList = {
17
- listType: listsTypes.bulletList,
18
- types: Object.assign({}, listsTypes)
19
- };
20
-
21
- export { bulletList, listsTypes, orderedList };