@dxos/react-ui-editor 0.3.11-main.1caa3af → 0.3.11-main.668f0ff
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 +29 -23
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/TextEditor/TextEditor.d.ts +2 -2
- package/dist/types/src/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/comments.d.ts.map +1 -1
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts +5 -4
- package/dist/types/src/components/TextEditor/extensions/listener.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/components/TextEditor/TextEditor.tsx +4 -4
- package/src/components/TextEditor/extensions/comments.ts +2 -1
- package/src/components/TextEditor/extensions/listener.ts +30 -14
|
@@ -1099,7 +1099,7 @@ var BookmarkWidget = class extends WidgetType {
|
|
|
1099
1099
|
this._handleClick = _handleClick;
|
|
1100
1100
|
invariant3(this._id, void 0, {
|
|
1101
1101
|
F: __dxlog_file5,
|
|
1102
|
-
L:
|
|
1102
|
+
L: 151,
|
|
1103
1103
|
S: this,
|
|
1104
1104
|
A: [
|
|
1105
1105
|
"this._id",
|
|
@@ -1125,7 +1125,7 @@ var comments = (options = {}) => {
|
|
|
1125
1125
|
const createCommentThread = (view) => {
|
|
1126
1126
|
invariant3(options.onCreate, void 0, {
|
|
1127
1127
|
F: __dxlog_file5,
|
|
1128
|
-
L:
|
|
1128
|
+
L: 205,
|
|
1129
1129
|
S: void 0,
|
|
1130
1130
|
A: [
|
|
1131
1131
|
"options.onCreate",
|
|
@@ -1207,7 +1207,7 @@ var comments = (options = {}) => {
|
|
|
1207
1207
|
options.onCreate ? keymap3.of([
|
|
1208
1208
|
{
|
|
1209
1209
|
key: options?.key ?? "meta-'",
|
|
1210
|
-
run: createCommentThread
|
|
1210
|
+
run: callbackWrapper(createCommentThread)
|
|
1211
1211
|
}
|
|
1212
1212
|
]) : [],
|
|
1213
1213
|
//
|
|
@@ -1251,7 +1251,7 @@ var comments = (options = {}) => {
|
|
|
1251
1251
|
changes.iterChanges((from, to, from2, to2) => {
|
|
1252
1252
|
invariant3(model, void 0, {
|
|
1253
1253
|
F: __dxlog_file5,
|
|
1254
|
-
L:
|
|
1254
|
+
L: 334,
|
|
1255
1255
|
S: void 0,
|
|
1256
1256
|
A: [
|
|
1257
1257
|
"model",
|
|
@@ -1266,7 +1266,7 @@ var comments = (options = {}) => {
|
|
|
1266
1266
|
thread: range.id
|
|
1267
1267
|
}, {
|
|
1268
1268
|
F: __dxlog_file5,
|
|
1269
|
-
L:
|
|
1269
|
+
L: 340,
|
|
1270
1270
|
S: void 0,
|
|
1271
1271
|
C: (f, a) => f(...a)
|
|
1272
1272
|
});
|
|
@@ -1508,17 +1508,23 @@ var update2 = (state, options) => {
|
|
|
1508
1508
|
|
|
1509
1509
|
// packages/ui/react-ui-editor/src/components/TextEditor/extensions/listener.ts
|
|
1510
1510
|
import { StateField as StateField6 } from "@codemirror/state";
|
|
1511
|
-
|
|
1512
|
-
|
|
1511
|
+
import { EditorView as EditorView8 } from "@codemirror/view";
|
|
1512
|
+
import { nonNullable as nonNullable2 } from "@dxos/util";
|
|
1513
|
+
var listener = ({ onFocus, onChange }) => [
|
|
1514
|
+
onFocus ? EditorView8.focusChangeEffect.of((view, focused) => {
|
|
1515
|
+
onFocus(focused);
|
|
1516
|
+
return null;
|
|
1517
|
+
}) : void 0,
|
|
1518
|
+
onChange ? StateField6.define({
|
|
1513
1519
|
create: () => null,
|
|
1514
1520
|
update: (_value, transaction) => {
|
|
1515
|
-
if (transaction.docChanged
|
|
1521
|
+
if (transaction.docChanged) {
|
|
1516
1522
|
onChange(transaction.newDoc.toString());
|
|
1517
1523
|
}
|
|
1518
1524
|
return null;
|
|
1519
1525
|
}
|
|
1520
|
-
})
|
|
1521
|
-
|
|
1526
|
+
}) : void 0
|
|
1527
|
+
].filter(nonNullable2);
|
|
1522
1528
|
|
|
1523
1529
|
// packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/bundle.ts
|
|
1524
1530
|
import { closeBrackets as closeBrackets2, closeBracketsKeymap } from "@codemirror/autocomplete";
|
|
@@ -1529,7 +1535,7 @@ import { languages } from "@codemirror/language-data";
|
|
|
1529
1535
|
import { searchKeymap } from "@codemirror/search";
|
|
1530
1536
|
import { EditorState } from "@codemirror/state";
|
|
1531
1537
|
import { oneDarkHighlightStyle as oneDarkHighlightStyle2 } from "@codemirror/theme-one-dark";
|
|
1532
|
-
import { crosshairCursor, drawSelection as drawSelection2, dropCursor, EditorView as
|
|
1538
|
+
import { crosshairCursor, drawSelection as drawSelection2, dropCursor, EditorView as EditorView9, highlightActiveLine, keymap as keymap4, placeholder as placeholder2 } from "@codemirror/view";
|
|
1533
1539
|
|
|
1534
1540
|
// packages/ui/react-ui-editor/src/components/TextEditor/extensions/markdown/highlight.ts
|
|
1535
1541
|
import { markdownLanguage } from "@codemirror/lang-markdown";
|
|
@@ -1732,7 +1738,7 @@ var markdownBundle = ({ readonly, themeMode, placeholder: _placeholder }) => {
|
|
|
1732
1738
|
return [
|
|
1733
1739
|
EditorState.allowMultipleSelections.of(true),
|
|
1734
1740
|
EditorState.tabSize.of(2),
|
|
1735
|
-
|
|
1741
|
+
EditorView9.lineWrapping,
|
|
1736
1742
|
customKeymap(),
|
|
1737
1743
|
bracketMatching2(),
|
|
1738
1744
|
closeBrackets2(),
|
|
@@ -1811,12 +1817,12 @@ var mermaid = () => {
|
|
|
1811
1817
|
// packages/ui/react-ui-editor/src/components/TextEditor/extensions/table.ts
|
|
1812
1818
|
import { syntaxTree as syntaxTree3 } from "@codemirror/language";
|
|
1813
1819
|
import { RangeSetBuilder as RangeSetBuilder3, StateField as StateField7 } from "@codemirror/state";
|
|
1814
|
-
import { Decoration as Decoration6, EditorView as
|
|
1820
|
+
import { Decoration as Decoration6, EditorView as EditorView10, WidgetType as WidgetType5 } from "@codemirror/view";
|
|
1815
1821
|
var table = (options = {}) => {
|
|
1816
1822
|
return StateField7.define({
|
|
1817
1823
|
create: (state) => update3(state, options),
|
|
1818
1824
|
update: (_, tr) => update3(tr.state, options),
|
|
1819
|
-
provide: (field) =>
|
|
1825
|
+
provide: (field) => EditorView10.decorations.from(field)
|
|
1820
1826
|
});
|
|
1821
1827
|
};
|
|
1822
1828
|
var update3 = (state, options) => {
|
|
@@ -1905,8 +1911,8 @@ var TableWidget = class extends WidgetType5 {
|
|
|
1905
1911
|
};
|
|
1906
1912
|
|
|
1907
1913
|
// packages/ui/react-ui-editor/src/components/TextEditor/extensions/tasklist.ts
|
|
1908
|
-
import { EditorView as
|
|
1909
|
-
var styles4 =
|
|
1914
|
+
import { EditorView as EditorView11, Decoration as Decoration7, WidgetType as WidgetType6, MatchDecorator as MatchDecorator3, ViewPlugin as ViewPlugin5 } from "@codemirror/view";
|
|
1915
|
+
var styles4 = EditorView11.baseTheme({
|
|
1910
1916
|
"& .cm-task-item": {
|
|
1911
1917
|
paddingLeft: "4px",
|
|
1912
1918
|
paddingRight: "8px"
|
|
@@ -1979,7 +1985,7 @@ var tasklist = (options = {}) => {
|
|
|
1979
1985
|
}
|
|
1980
1986
|
}, {
|
|
1981
1987
|
decorations: (value) => value.tasks,
|
|
1982
|
-
provide: (plugin) =>
|
|
1988
|
+
provide: (plugin) => EditorView11.atomicRanges.of((view) => {
|
|
1983
1989
|
return view.plugin(plugin)?.tasks || Decoration7.none;
|
|
1984
1990
|
})
|
|
1985
1991
|
});
|
|
@@ -2364,7 +2370,7 @@ var codeTheme = {
|
|
|
2364
2370
|
|
|
2365
2371
|
// packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx
|
|
2366
2372
|
import { EditorState as EditorState2 } from "@codemirror/state";
|
|
2367
|
-
import { EditorView as
|
|
2373
|
+
import { EditorView as EditorView12 } from "@codemirror/view";
|
|
2368
2374
|
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
2369
2375
|
import { vim } from "@replit/codemirror-vim";
|
|
2370
2376
|
import defaultsDeep2 from "lodash.defaultsdeep";
|
|
@@ -2376,7 +2382,7 @@ var EditorModes = [
|
|
|
2376
2382
|
"default",
|
|
2377
2383
|
"vim"
|
|
2378
2384
|
];
|
|
2379
|
-
var BaseTextEditor = /* @__PURE__ */ forwardRef(({ model, comments: comments2,
|
|
2385
|
+
var BaseTextEditor = /* @__PURE__ */ forwardRef(({ model, readonly, comments: comments2, extensions = [], editorMode, slots = defaultSlots }, forwardedRef) => {
|
|
2380
2386
|
const { themeMode } = useThemeContext();
|
|
2381
2387
|
const tabsterDOMAttribute = useFocusableGroup({
|
|
2382
2388
|
tabBehavior: "limited"
|
|
@@ -2438,9 +2444,9 @@ var BaseTextEditor = /* @__PURE__ */ forwardRef(({ model, comments: comments2, r
|
|
|
2438
2444
|
editorMode === "vim" && vim(),
|
|
2439
2445
|
// Theme.
|
|
2440
2446
|
// TODO(burdon): Make theme configurable.
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2447
|
+
EditorView12.baseTheme(defaultTheme),
|
|
2448
|
+
EditorView12.theme(slots?.editor?.theme ?? {}),
|
|
2449
|
+
EditorView12.darkTheme.of(themeMode === "dark"),
|
|
2444
2450
|
// Storage and replication.
|
|
2445
2451
|
model.extension,
|
|
2446
2452
|
// Custom.
|
|
@@ -2450,7 +2456,7 @@ var BaseTextEditor = /* @__PURE__ */ forwardRef(({ model, comments: comments2, r
|
|
|
2450
2456
|
view?.destroy();
|
|
2451
2457
|
setEditor({
|
|
2452
2458
|
state: state2,
|
|
2453
|
-
view: new
|
|
2459
|
+
view: new EditorView12({
|
|
2454
2460
|
state: state2,
|
|
2455
2461
|
parent: root
|
|
2456
2462
|
})
|