@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.
@@ -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%',