@dxos/react-ui-editor 0.5.3-main.bc67fdb → 0.5.3-main.bfb5bca
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/dist/lib/browser/index.mjs +23 -2
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts +3 -0
- package/dist/types/src/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +2 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts +1 -0
- package/dist/types/src/extensions/automerge/automerge.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/comments.d.ts +1 -1
- package/dist/types/src/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/decorate.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/formatting.d.ts +2 -2
- package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/link.d.ts.map +1 -1
- package/dist/types/src/hooks/useTextEditor.stories.d.ts +1 -0
- package/dist/types/src/hooks/useTextEditor.stories.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/components/TextEditor/TextEditor.stories.tsx +17 -1
- package/src/extensions/comments.ts +1 -1
- package/src/extensions/markdown/decorate.ts +27 -1
|
@@ -77,6 +77,9 @@ const hide = Decoration.replace({});
|
|
|
77
77
|
const fencedCodeLine = Decoration.line({ class: mx('cm-code cm-codeblock-line') });
|
|
78
78
|
const fencedCodeLineFirst = Decoration.line({ class: mx('cm-code cm-codeblock-line', 'cm-codeblock-first') });
|
|
79
79
|
const fencedCodeLineLast = Decoration.line({ class: mx('cm-code cm-codeblock-line', 'cm-codeblock-last') });
|
|
80
|
+
const commentBlockLine = fencedCodeLine;
|
|
81
|
+
const commentBlockLineFirst = fencedCodeLineFirst;
|
|
82
|
+
const commentBlockLineLast = fencedCodeLineLast;
|
|
80
83
|
const horizontalRule = Decoration.replace({ widget: new HorizontalRuleWidget() });
|
|
81
84
|
const checkedTask = Decoration.replace({ widget: new CheckboxWidget(true) });
|
|
82
85
|
const uncheckedTask = Decoration.replace({ widget: new CheckboxWidget(false) });
|
|
@@ -105,6 +108,30 @@ const buildDecorations = (view: EditorView, options: DecorateOptions, focus: boo
|
|
|
105
108
|
to,
|
|
106
109
|
enter: (node) => {
|
|
107
110
|
switch (node.name) {
|
|
111
|
+
// CommentBlock
|
|
112
|
+
case 'CommentBlock': {
|
|
113
|
+
const editing = editingRange(state, node, focus);
|
|
114
|
+
for (const block of view.viewportLineBlocks) {
|
|
115
|
+
if (block.to < node.from) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (block.from > node.to) {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
const first = block.from <= node.from;
|
|
122
|
+
const last = block.to >= node.to && /^(\s>)*-->$/.test(state.doc.sliceString(block.from, block.to));
|
|
123
|
+
deco.add(
|
|
124
|
+
block.from,
|
|
125
|
+
block.from,
|
|
126
|
+
first ? commentBlockLineFirst : last ? commentBlockLineLast : commentBlockLine,
|
|
127
|
+
);
|
|
128
|
+
if (!editing && (first || last)) {
|
|
129
|
+
atomicDeco.add(block.from, block.to, hide);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
|
|
108
135
|
// FencedCode > CodeMark > [CodeInfo] > CodeText > CodeMark
|
|
109
136
|
case 'FencedCode': {
|
|
110
137
|
const editing = editingRange(state, node, focus);
|
|
@@ -289,7 +316,6 @@ const formattingStyles = EditorView.baseTheme({
|
|
|
289
316
|
'& .cm-codeblock-line': {
|
|
290
317
|
paddingInline: '1rem !important',
|
|
291
318
|
},
|
|
292
|
-
|
|
293
319
|
'& .cm-codeblock-end': {
|
|
294
320
|
display: 'inline-block',
|
|
295
321
|
width: '100%',
|