@modusoperandi/licit 1.4.7 → 1.4.9
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/ParagraphNodeSpec.js +21 -2
- package/ParagraphNodeSpec.js.flow +22 -2
- package/TextInsertTabSpaceCommand.js +18 -0
- package/TextInsertTabSpaceCommand.js.flow +16 -0
- package/bom.xml +9149 -10365
- package/package.json +20 -23
- package/ui/czi-editor.css +1 -3
package/ParagraphNodeSpec.js
CHANGED
|
@@ -72,6 +72,13 @@ var ParagraphNodeSpec = {
|
|
|
72
72
|
},
|
|
73
73
|
indentPosition: {
|
|
74
74
|
"default": null
|
|
75
|
+
},
|
|
76
|
+
isDeco: {
|
|
77
|
+
"default": {
|
|
78
|
+
isTag: false,
|
|
79
|
+
isComment: false,
|
|
80
|
+
isSlice: false
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
},
|
|
77
84
|
content: 'inline*',
|
|
@@ -110,6 +117,11 @@ function getAttrs(dom) {
|
|
|
110
117
|
var objectId = dom.getAttribute('objectId') || '';
|
|
111
118
|
var hangingIndent = dom.getAttribute('hangingIndent') || '';
|
|
112
119
|
var indentPosition = dom.getAttribute('indentPosition') || '';
|
|
120
|
+
var isDeco = {
|
|
121
|
+
isTag: dom.getAttribute('isTag') === 'true',
|
|
122
|
+
isComment: dom.getAttribute('isComment') === 'true',
|
|
123
|
+
isSlice: dom.getAttribute('isSlice') === 'true'
|
|
124
|
+
};
|
|
113
125
|
return {
|
|
114
126
|
align: align,
|
|
115
127
|
indent: indent,
|
|
@@ -127,7 +139,8 @@ function getAttrs(dom) {
|
|
|
127
139
|
selectionId: selectionId,
|
|
128
140
|
objectId: objectId,
|
|
129
141
|
hangingIndent: hangingIndent,
|
|
130
|
-
indentPosition: indentPosition
|
|
142
|
+
indentPosition: indentPosition,
|
|
143
|
+
isDeco: isDeco
|
|
131
144
|
};
|
|
132
145
|
}
|
|
133
146
|
function getStyle(attrs) {
|
|
@@ -167,7 +180,8 @@ function toDOM(node) {
|
|
|
167
180
|
overriddenIndentValue = _node$attrs.overriddenIndentValue,
|
|
168
181
|
selectionId = _node$attrs.selectionId,
|
|
169
182
|
hangingIndent = _node$attrs.hangingIndent,
|
|
170
|
-
indentPosition = _node$attrs.indentPosition
|
|
183
|
+
indentPosition = _node$attrs.indentPosition,
|
|
184
|
+
isDeco = _node$attrs.isDeco;
|
|
171
185
|
var attrs = _objectSpread({}, node.attrs);
|
|
172
186
|
var _getStyle = getStyle(node.attrs),
|
|
173
187
|
style = _getStyle.style;
|
|
@@ -195,6 +209,11 @@ function toDOM(node) {
|
|
|
195
209
|
if (selectionId) {
|
|
196
210
|
attrs.selectionId = selectionId;
|
|
197
211
|
}
|
|
212
|
+
if (isDeco) {
|
|
213
|
+
if (isDeco.isTag !== undefined) attrs.isTag = String(isDeco.isTag);
|
|
214
|
+
if (isDeco.isComment !== undefined) attrs.isComment = String(isDeco.isComment);
|
|
215
|
+
if (isDeco.isSlice !== undefined) attrs.isSlice = String(isDeco.isSlice);
|
|
216
|
+
}
|
|
198
217
|
return ['p', attrs, 0];
|
|
199
218
|
}
|
|
200
219
|
export var toParagraphDOM = toDOM;
|
|
@@ -74,6 +74,13 @@ const ParagraphNodeSpec: NodeSpec = {
|
|
|
74
74
|
indentPosition: {
|
|
75
75
|
default: null,
|
|
76
76
|
},
|
|
77
|
+
isDeco: {
|
|
78
|
+
default: {
|
|
79
|
+
isTag: false,
|
|
80
|
+
isComment: false,
|
|
81
|
+
isSlice: false,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
77
84
|
},
|
|
78
85
|
content: 'inline*',
|
|
79
86
|
group: 'block',
|
|
@@ -116,6 +123,11 @@ function getAttrs(dom: HTMLElement): Object {
|
|
|
116
123
|
const objectId = dom.getAttribute('objectId') || '';
|
|
117
124
|
const hangingIndent = dom.getAttribute('hangingIndent') || '';
|
|
118
125
|
const indentPosition = dom.getAttribute('indentPosition') || '';
|
|
126
|
+
const isDeco = {
|
|
127
|
+
isTag: dom.getAttribute('isTag') === 'true',
|
|
128
|
+
isComment: dom.getAttribute('isComment') === 'true',
|
|
129
|
+
isSlice: dom.getAttribute('isSlice') === 'true',
|
|
130
|
+
};
|
|
119
131
|
return {
|
|
120
132
|
align,
|
|
121
133
|
indent,
|
|
@@ -133,7 +145,8 @@ function getAttrs(dom: HTMLElement): Object {
|
|
|
133
145
|
selectionId,
|
|
134
146
|
objectId,
|
|
135
147
|
hangingIndent,
|
|
136
|
-
indentPosition
|
|
148
|
+
indentPosition,
|
|
149
|
+
isDeco
|
|
137
150
|
};
|
|
138
151
|
}
|
|
139
152
|
|
|
@@ -183,7 +196,8 @@ function toDOM(node: Node): Array<any> {
|
|
|
183
196
|
overriddenIndentValue,
|
|
184
197
|
selectionId,
|
|
185
198
|
hangingIndent,
|
|
186
|
-
indentPosition
|
|
199
|
+
indentPosition,
|
|
200
|
+
isDeco
|
|
187
201
|
} = node.attrs;
|
|
188
202
|
const attrs = { ...node.attrs };
|
|
189
203
|
const { style } = getStyle(node.attrs);
|
|
@@ -215,6 +229,12 @@ function toDOM(node: Node): Array<any> {
|
|
|
215
229
|
attrs.selectionId = selectionId;
|
|
216
230
|
}
|
|
217
231
|
|
|
232
|
+
if (isDeco) {
|
|
233
|
+
if (isDeco.isTag !== undefined) attrs.isTag = String(isDeco.isTag);
|
|
234
|
+
if (isDeco.isComment !== undefined) attrs.isComment = String(isDeco.isComment);
|
|
235
|
+
if (isDeco.isSlice !== undefined) attrs.isSlice = String(isDeco.isSlice);
|
|
236
|
+
}
|
|
237
|
+
|
|
218
238
|
return ['p', attrs, 0];
|
|
219
239
|
}
|
|
220
240
|
|
|
@@ -48,6 +48,9 @@ function insertTabSpace(state, tr, schema) {
|
|
|
48
48
|
return tr;
|
|
49
49
|
}
|
|
50
50
|
var textNode = schema.text(HAIR_SPACE_CHAR);
|
|
51
|
+
if (paragraphHasSpacerMark(found.node)) {
|
|
52
|
+
return tr;
|
|
53
|
+
}
|
|
51
54
|
tr = tr.insert(to, Fragment.from(textNode));
|
|
52
55
|
var attrs = {
|
|
53
56
|
size: SPACER_SIZE_TAB
|
|
@@ -57,6 +60,21 @@ function insertTabSpace(state, tr, schema) {
|
|
|
57
60
|
tr = tr.setSelection(TextSelection.create(tr.doc, to + 1, to + 1));
|
|
58
61
|
return tr;
|
|
59
62
|
}
|
|
63
|
+
// Check if a paragraph node has a hanging indent mark applied to any of its text nodes
|
|
64
|
+
// if yes, return true otherwise false, to avoid strange behavior with multiple hanging indent marks
|
|
65
|
+
function paragraphHasSpacerMark(node) {
|
|
66
|
+
var found = false;
|
|
67
|
+
node.descendants(function (child) {
|
|
68
|
+
if (child.isText && child.marks.some(function (m) {
|
|
69
|
+
return m.type.name === 'mark-hanging-indent';
|
|
70
|
+
})) {
|
|
71
|
+
found = true;
|
|
72
|
+
return false; // stop traversal
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
});
|
|
76
|
+
return found;
|
|
77
|
+
}
|
|
60
78
|
var TextInsertTabSpaceCommand = /*#__PURE__*/function (_UICommand) {
|
|
61
79
|
function TextInsertTabSpaceCommand() {
|
|
62
80
|
var _this;
|
|
@@ -47,6 +47,9 @@ function insertTabSpace(
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const textNode = schema.text(HAIR_SPACE_CHAR);
|
|
50
|
+
if (paragraphHasSpacerMark(found.node)) {
|
|
51
|
+
return tr;
|
|
52
|
+
}
|
|
50
53
|
tr = tr.insert(to, Fragment.from(textNode));
|
|
51
54
|
const attrs = {
|
|
52
55
|
size: SPACER_SIZE_TAB,
|
|
@@ -60,6 +63,19 @@ function insertTabSpace(
|
|
|
60
63
|
|
|
61
64
|
return tr;
|
|
62
65
|
}
|
|
66
|
+
// Check if a paragraph node has a hanging indent mark applied to any of its text nodes
|
|
67
|
+
// if yes, return true otherwise false, to avoid strange behavior with multiple hanging indent marks
|
|
68
|
+
function paragraphHasSpacerMark(node) {
|
|
69
|
+
let found = false;
|
|
70
|
+
node.descendants((child) => {
|
|
71
|
+
if (child.isText && child.marks.some(m => m.type.name === 'mark-hanging-indent')) {
|
|
72
|
+
found = true;
|
|
73
|
+
return false; // stop traversal
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
});
|
|
77
|
+
return found;
|
|
78
|
+
}
|
|
63
79
|
|
|
64
80
|
class TextInsertTabSpaceCommand extends UICommand {
|
|
65
81
|
execute = (
|