@dxos/react-ui-editor 0.5.9-next.a50ff17 → 0.6.0
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 +151 -51
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/extensions/markdown/bundle.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/formatting.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -1
- package/dist/types/src/extensions/markdown/linkPaste.d.ts +15 -0
- package/dist/types/src/extensions/markdown/linkPaste.d.ts.map +1 -0
- package/package.json +25 -25
- package/src/extensions/markdown/bundle.ts +3 -0
- package/src/extensions/markdown/formatting.ts +4 -0
- package/src/extensions/markdown/highlight.ts +1 -18
- package/src/extensions/markdown/linkPaste.ts +104 -0
|
@@ -477,6 +477,7 @@ import { Annotation as Annotation2, Facet as Facet2, RangeSet } from "@codemirro
|
|
|
477
477
|
import { Decoration as Decoration2, EditorView as EditorView3, ViewPlugin as ViewPlugin2, WidgetType } from "@codemirror/view";
|
|
478
478
|
import { Event } from "@dxos/async";
|
|
479
479
|
import { Context } from "@dxos/context";
|
|
480
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness.ts";
|
|
480
481
|
var dummyProvider = {
|
|
481
482
|
remoteStateChange: new Event(),
|
|
482
483
|
open: () => {
|
|
@@ -503,7 +504,10 @@ var awareness = (provider = dummyProvider) => {
|
|
|
503
504
|
var RemoteSelectionsDecorator = class {
|
|
504
505
|
constructor(view) {
|
|
505
506
|
this.decorations = RangeSet.of([]);
|
|
506
|
-
this._ctx = new Context(
|
|
507
|
+
this._ctx = new Context(void 0, {
|
|
508
|
+
F: __dxlog_file2,
|
|
509
|
+
L: 85
|
|
510
|
+
});
|
|
507
511
|
this._lastAnchor = void 0;
|
|
508
512
|
this._lastHead = void 0;
|
|
509
513
|
this._cursorConverter = view.state.facet(Cursor.converter);
|
|
@@ -712,7 +716,7 @@ import { DeferredTask, Event as Event2, sleep } from "@dxos/async";
|
|
|
712
716
|
import { Context as Context2 } from "@dxos/context";
|
|
713
717
|
import { invariant } from "@dxos/invariant";
|
|
714
718
|
import { log as log2 } from "@dxos/log";
|
|
715
|
-
var
|
|
719
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/awareness/awareness-provider.ts";
|
|
716
720
|
var DEBOUNCE_INTERVAL = 100;
|
|
717
721
|
var SpaceAwarenessProvider = class {
|
|
718
722
|
constructor(params) {
|
|
@@ -724,7 +728,10 @@ var SpaceAwarenessProvider = class {
|
|
|
724
728
|
this._info = params.info;
|
|
725
729
|
}
|
|
726
730
|
open() {
|
|
727
|
-
this._ctx = new Context2(
|
|
731
|
+
this._ctx = new Context2(void 0, {
|
|
732
|
+
F: __dxlog_file3,
|
|
733
|
+
L: 57
|
|
734
|
+
});
|
|
728
735
|
this._postTask = new DeferredTask(this._ctx, async () => {
|
|
729
736
|
if (this._localState) {
|
|
730
737
|
await this._space.postMessage(this._channel, {
|
|
@@ -752,7 +759,7 @@ var SpaceAwarenessProvider = class {
|
|
|
752
759
|
log2.debug("failed to query awareness", {
|
|
753
760
|
err
|
|
754
761
|
}, {
|
|
755
|
-
F:
|
|
762
|
+
F: __dxlog_file3,
|
|
756
763
|
L: 89,
|
|
757
764
|
S: this,
|
|
758
765
|
C: (f, a) => f(...a)
|
|
@@ -769,7 +776,7 @@ var SpaceAwarenessProvider = class {
|
|
|
769
776
|
}
|
|
770
777
|
update(position) {
|
|
771
778
|
invariant(this._postTask, void 0, {
|
|
772
|
-
F:
|
|
779
|
+
F: __dxlog_file3,
|
|
773
780
|
L: 104,
|
|
774
781
|
S: this,
|
|
775
782
|
A: [
|
|
@@ -786,7 +793,7 @@ var SpaceAwarenessProvider = class {
|
|
|
786
793
|
}
|
|
787
794
|
_handleQueryMessage() {
|
|
788
795
|
invariant(this._postTask, void 0, {
|
|
789
|
-
F:
|
|
796
|
+
F: __dxlog_file3,
|
|
790
797
|
L: 115,
|
|
791
798
|
S: this,
|
|
792
799
|
A: [
|
|
@@ -798,7 +805,7 @@ var SpaceAwarenessProvider = class {
|
|
|
798
805
|
}
|
|
799
806
|
_handlePostMessage(message) {
|
|
800
807
|
invariant(message.kind === "post", void 0, {
|
|
801
|
-
F:
|
|
808
|
+
F: __dxlog_file3,
|
|
802
809
|
L: 120,
|
|
803
810
|
S: this,
|
|
804
811
|
A: [
|
|
@@ -815,7 +822,7 @@ var SpaceAwarenessProvider = class {
|
|
|
815
822
|
import { EditorView as EditorView4, keymap as keymap2 } from "@codemirror/view";
|
|
816
823
|
import defaultsDeep from "lodash.defaultsdeep";
|
|
817
824
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
818
|
-
var
|
|
825
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/blast.ts";
|
|
819
826
|
var defaultOptions = {
|
|
820
827
|
effect: 2,
|
|
821
828
|
maxParticles: 200,
|
|
@@ -942,7 +949,7 @@ var Blaster = class {
|
|
|
942
949
|
}
|
|
943
950
|
initialize() {
|
|
944
951
|
invariant2(!this._canvas && !this._ctx, void 0, {
|
|
945
|
-
F:
|
|
952
|
+
F: __dxlog_file4,
|
|
946
953
|
L: 141,
|
|
947
954
|
S: this,
|
|
948
955
|
A: [
|
|
@@ -979,7 +986,7 @@ var Blaster = class {
|
|
|
979
986
|
}
|
|
980
987
|
start() {
|
|
981
988
|
invariant2(this._canvas && this._ctx, void 0, {
|
|
982
|
-
F:
|
|
989
|
+
F: __dxlog_file4,
|
|
983
990
|
L: 180,
|
|
984
991
|
S: this,
|
|
985
992
|
A: [
|
|
@@ -1384,13 +1391,13 @@ var editorFillLayoutEditor = "!absolute inset-0";
|
|
|
1384
1391
|
|
|
1385
1392
|
// packages/ui/react-ui-editor/src/util.ts
|
|
1386
1393
|
import { log as log3 } from "@dxos/log";
|
|
1387
|
-
var
|
|
1394
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/util.ts";
|
|
1388
1395
|
var callbackWrapper = (fn) => (...args) => {
|
|
1389
1396
|
try {
|
|
1390
1397
|
return fn(...args);
|
|
1391
1398
|
} catch (err) {
|
|
1392
1399
|
log3.catch(err, void 0, {
|
|
1393
|
-
F:
|
|
1400
|
+
F: __dxlog_file5,
|
|
1394
1401
|
L: 18,
|
|
1395
1402
|
S: void 0,
|
|
1396
1403
|
C: (f, a) => f(...a)
|
|
@@ -1416,7 +1423,7 @@ var logChanges = (trs) => {
|
|
|
1416
1423
|
log3.info("changes", {
|
|
1417
1424
|
changes
|
|
1418
1425
|
}, {
|
|
1419
|
-
F:
|
|
1426
|
+
F: __dxlog_file5,
|
|
1420
1427
|
L: 39,
|
|
1421
1428
|
S: void 0,
|
|
1422
1429
|
C: (f, a) => f(...a)
|
|
@@ -1425,7 +1432,7 @@ var logChanges = (trs) => {
|
|
|
1425
1432
|
};
|
|
1426
1433
|
|
|
1427
1434
|
// packages/ui/react-ui-editor/src/extensions/comments.ts
|
|
1428
|
-
var
|
|
1435
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/comments.ts";
|
|
1429
1436
|
var documentId = Facet4.define({
|
|
1430
1437
|
combine: (values) => values[0]
|
|
1431
1438
|
});
|
|
@@ -1512,7 +1519,7 @@ var commentsDecorations = EditorView7.decorations.compute([
|
|
|
1512
1519
|
const range = comment.range;
|
|
1513
1520
|
if (!range || range.from === range.to) {
|
|
1514
1521
|
log4.warn("Invalid range:", range, {
|
|
1515
|
-
F:
|
|
1522
|
+
F: __dxlog_file6,
|
|
1516
1523
|
L: 132,
|
|
1517
1524
|
S: void 0,
|
|
1518
1525
|
C: (f, a) => f(...a)
|
|
@@ -1833,11 +1840,11 @@ var useComments = (view, id, comments2) => {
|
|
|
1833
1840
|
// packages/ui/react-ui-editor/src/extensions/doc.ts
|
|
1834
1841
|
import { Facet as Facet5 } from "@codemirror/state";
|
|
1835
1842
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1836
|
-
var
|
|
1843
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/doc.ts";
|
|
1837
1844
|
var documentId2 = Facet5.define({
|
|
1838
1845
|
combine: (providers) => {
|
|
1839
1846
|
invariant3(providers.length <= 1, void 0, {
|
|
1840
|
-
F:
|
|
1847
|
+
F: __dxlog_file7,
|
|
1841
1848
|
L: 11,
|
|
1842
1849
|
S: void 0,
|
|
1843
1850
|
A: [
|
|
@@ -2142,7 +2149,7 @@ var defaultTheme = {
|
|
|
2142
2149
|
};
|
|
2143
2150
|
|
|
2144
2151
|
// packages/ui/react-ui-editor/src/extensions/factories.ts
|
|
2145
|
-
var
|
|
2152
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/factories.ts";
|
|
2146
2153
|
var defaultBasicOptions = {
|
|
2147
2154
|
allowMultipleSelections: true,
|
|
2148
2155
|
bracketMatching: true,
|
|
@@ -2166,7 +2173,7 @@ var createBasicExtensions = (_props) => {
|
|
|
2166
2173
|
// NOTE: Doesn't catch errors in keymap functions.
|
|
2167
2174
|
EditorView9.exceptionSink.of((err) => {
|
|
2168
2175
|
log5.catch(err, void 0, {
|
|
2169
|
-
F:
|
|
2176
|
+
F: __dxlog_file8,
|
|
2170
2177
|
L: 90,
|
|
2171
2178
|
S: void 0,
|
|
2172
2179
|
C: (f, a) => f(...a)
|
|
@@ -3156,6 +3163,10 @@ var formattingKeymap = (options = {}) => {
|
|
|
3156
3163
|
{
|
|
3157
3164
|
key: "meta-b",
|
|
3158
3165
|
run: toggleStrong
|
|
3166
|
+
},
|
|
3167
|
+
{
|
|
3168
|
+
key: "meta-i",
|
|
3169
|
+
run: toggleEmphasis
|
|
3159
3170
|
}
|
|
3160
3171
|
])
|
|
3161
3172
|
];
|
|
@@ -3577,13 +3588,6 @@ var markdownHighlightStyle = (readonly) => {
|
|
|
3577
3588
|
tag: tags.strikethrough,
|
|
3578
3589
|
class: strikethrough
|
|
3579
3590
|
},
|
|
3580
|
-
// Naked URLs.
|
|
3581
|
-
{
|
|
3582
|
-
tag: [
|
|
3583
|
-
markdownTags.URL
|
|
3584
|
-
],
|
|
3585
|
-
class: inlineUrl
|
|
3586
|
-
},
|
|
3587
3591
|
// NOTE: The `markdown` extension configures extensions for `lezer` to parse markdown tokens (incl. below).
|
|
3588
3592
|
// However, since `codeLanguages` is also defined, the `lezer` will not parse fenced code blocks,
|
|
3589
3593
|
// when a language is specified. In this case, the syntax highlighting extensions will colorize
|
|
@@ -3616,6 +3620,101 @@ var markdownHighlightStyle = (readonly) => {
|
|
|
3616
3620
|
});
|
|
3617
3621
|
};
|
|
3618
3622
|
|
|
3623
|
+
// packages/ui/react-ui-editor/src/extensions/markdown/linkPaste.ts
|
|
3624
|
+
import { syntaxTree as syntaxTree2 } from "@codemirror/language";
|
|
3625
|
+
import { Transaction } from "@codemirror/state";
|
|
3626
|
+
import { ViewPlugin as ViewPlugin4 } from "@codemirror/view";
|
|
3627
|
+
var VALID_PROTOCOLS = [
|
|
3628
|
+
"http:",
|
|
3629
|
+
"https:",
|
|
3630
|
+
"mailto:",
|
|
3631
|
+
"tel:"
|
|
3632
|
+
];
|
|
3633
|
+
var createTextLink = (text, url) => `[${text}](${url})`;
|
|
3634
|
+
var createUrlLink = (url) => {
|
|
3635
|
+
const displayUrl = formatUrlForDisplay(url);
|
|
3636
|
+
return `[${displayUrl}](${url})`;
|
|
3637
|
+
};
|
|
3638
|
+
var formatUrlForDisplay = (url) => {
|
|
3639
|
+
const withoutProtocol = url.replace(/^https?:\/\//, "");
|
|
3640
|
+
return truncateQueryParams(withoutProtocol);
|
|
3641
|
+
};
|
|
3642
|
+
var truncateQueryParams = (url, maxQueryLength = 15) => {
|
|
3643
|
+
const [urlBase, queryString] = url.split("?");
|
|
3644
|
+
if (!queryString) {
|
|
3645
|
+
return urlBase;
|
|
3646
|
+
}
|
|
3647
|
+
if (queryString.length > maxQueryLength) {
|
|
3648
|
+
const truncatedQuery = queryString.slice(0, maxQueryLength) + "...";
|
|
3649
|
+
return `${urlBase}?${truncatedQuery}`;
|
|
3650
|
+
} else {
|
|
3651
|
+
return `${urlBase}?${queryString}`;
|
|
3652
|
+
}
|
|
3653
|
+
};
|
|
3654
|
+
var isValidUrl = (str) => {
|
|
3655
|
+
try {
|
|
3656
|
+
const url = new URL(str);
|
|
3657
|
+
return VALID_PROTOCOLS.includes(url.protocol);
|
|
3658
|
+
} catch (e) {
|
|
3659
|
+
return false;
|
|
3660
|
+
}
|
|
3661
|
+
};
|
|
3662
|
+
var onNextUpdate = (callback) => setTimeout(callback, 0);
|
|
3663
|
+
var linkPastePlugin = ViewPlugin4.fromClass(class {
|
|
3664
|
+
constructor(view) {
|
|
3665
|
+
this.view = view;
|
|
3666
|
+
}
|
|
3667
|
+
update(update2) {
|
|
3668
|
+
for (const tr of update2.transactions) {
|
|
3669
|
+
const event = tr.annotation(Transaction.userEvent);
|
|
3670
|
+
if (event === "input.paste") {
|
|
3671
|
+
this.handleInputRead(this.view, tr);
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
handleInputRead(view, tr) {
|
|
3676
|
+
const changes = tr.changes;
|
|
3677
|
+
if (changes.empty) {
|
|
3678
|
+
return;
|
|
3679
|
+
}
|
|
3680
|
+
changes.iterChangedRanges((fromA, toA, fromB, toB) => {
|
|
3681
|
+
const insertedText = view.state.sliceDoc(fromB, toB);
|
|
3682
|
+
if (isValidUrl(insertedText) && !this.isInCodeBlock(view.state, fromB)) {
|
|
3683
|
+
const replacedText = tr.startState.sliceDoc(fromA, toA);
|
|
3684
|
+
onNextUpdate(() => {
|
|
3685
|
+
view.dispatch(this.createLinkTransaction(view.state, fromA, toB, insertedText, replacedText));
|
|
3686
|
+
});
|
|
3687
|
+
}
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
/**
|
|
3691
|
+
* Determines if a given position is within a code block.
|
|
3692
|
+
* Traverses the syntax tree upwards from the position,
|
|
3693
|
+
* checking for CodeBlock or FencedCode nodes.
|
|
3694
|
+
*/
|
|
3695
|
+
isInCodeBlock(state2, pos) {
|
|
3696
|
+
const tree = syntaxTree2(state2);
|
|
3697
|
+
let node = tree.resolveInner(pos, -1);
|
|
3698
|
+
while (node) {
|
|
3699
|
+
if (node.name.includes("Code") || node.name.includes("FencedCode")) {
|
|
3700
|
+
return true;
|
|
3701
|
+
}
|
|
3702
|
+
node = node.parent;
|
|
3703
|
+
}
|
|
3704
|
+
return false;
|
|
3705
|
+
}
|
|
3706
|
+
createLinkTransaction(state2, from, to, url, text) {
|
|
3707
|
+
const linkText = text.trim() ? createTextLink(text, url) : createUrlLink(url);
|
|
3708
|
+
return state2.update({
|
|
3709
|
+
changes: {
|
|
3710
|
+
from,
|
|
3711
|
+
to,
|
|
3712
|
+
insert: linkText
|
|
3713
|
+
}
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
});
|
|
3717
|
+
|
|
3619
3718
|
// packages/ui/react-ui-editor/src/extensions/markdown/bundle.ts
|
|
3620
3719
|
var createMarkdownExtensions = ({ themeMode } = {}) => {
|
|
3621
3720
|
return [
|
|
@@ -3641,6 +3740,7 @@ var createMarkdownExtensions = ({ themeMode } = {}) => {
|
|
|
3641
3740
|
themeMode === "dark" ? syntaxHighlighting(oneDarkHighlightStyle) : syntaxHighlighting(defaultHighlightStyle),
|
|
3642
3741
|
// Custom styles.
|
|
3643
3742
|
syntaxHighlighting(markdownHighlightStyle()),
|
|
3743
|
+
linkPastePlugin,
|
|
3644
3744
|
keymap7.of([
|
|
3645
3745
|
// https://codemirror.net/docs/ref/#commands.indentWithTab
|
|
3646
3746
|
indentWithTab2,
|
|
@@ -3653,9 +3753,9 @@ var createMarkdownExtensions = ({ themeMode } = {}) => {
|
|
|
3653
3753
|
};
|
|
3654
3754
|
|
|
3655
3755
|
// packages/ui/react-ui-editor/src/extensions/markdown/decorate.ts
|
|
3656
|
-
import { syntaxTree as
|
|
3756
|
+
import { syntaxTree as syntaxTree3 } from "@codemirror/language";
|
|
3657
3757
|
import { RangeSetBuilder as RangeSetBuilder2, StateEffect as StateEffect4 } from "@codemirror/state";
|
|
3658
|
-
import { EditorView as EditorView12, Decoration as Decoration5, WidgetType as WidgetType3, ViewPlugin as
|
|
3758
|
+
import { EditorView as EditorView12, Decoration as Decoration5, WidgetType as WidgetType3, ViewPlugin as ViewPlugin5 } from "@codemirror/view";
|
|
3659
3759
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
3660
3760
|
var HorizontalRuleWidget = class extends WidgetType3 {
|
|
3661
3761
|
toDOM() {
|
|
@@ -3754,7 +3854,7 @@ var buildDecorations = (view, options, focus) => {
|
|
|
3754
3854
|
const atomicDeco = new RangeSetBuilder2();
|
|
3755
3855
|
const { state: state2 } = view;
|
|
3756
3856
|
for (const { from, to } of view.visibleRanges) {
|
|
3757
|
-
|
|
3857
|
+
syntaxTree3(state2).iterate({
|
|
3758
3858
|
from,
|
|
3759
3859
|
to,
|
|
3760
3860
|
enter: (node) => {
|
|
@@ -3871,7 +3971,7 @@ var buildDecorations = (view, options, focus) => {
|
|
|
3871
3971
|
var forceUpdate = StateEffect4.define();
|
|
3872
3972
|
var decorateMarkdown = (options = {}) => {
|
|
3873
3973
|
return [
|
|
3874
|
-
|
|
3974
|
+
ViewPlugin5.fromClass(class {
|
|
3875
3975
|
constructor(view) {
|
|
3876
3976
|
({ deco: this.deco, atomicDeco: this.atomicDeco } = buildDecorations(view, options, view.hasFocus));
|
|
3877
3977
|
}
|
|
@@ -3960,7 +4060,7 @@ var formattingStyles = EditorView12.baseTheme({
|
|
|
3960
4060
|
});
|
|
3961
4061
|
|
|
3962
4062
|
// packages/ui/react-ui-editor/src/extensions/markdown/image.ts
|
|
3963
|
-
import { syntaxTree as
|
|
4063
|
+
import { syntaxTree as syntaxTree4 } from "@codemirror/language";
|
|
3964
4064
|
import { StateField as StateField5 } from "@codemirror/state";
|
|
3965
4065
|
import { Decoration as Decoration6, EditorView as EditorView13, WidgetType as WidgetType4 } from "@codemirror/view";
|
|
3966
4066
|
var image = (options = {}) => {
|
|
@@ -4003,7 +4103,7 @@ var preloadImage = (url) => {
|
|
|
4003
4103
|
var buildDecorations2 = (from, to, state2) => {
|
|
4004
4104
|
const decorations = [];
|
|
4005
4105
|
const cursor = state2.selection.main.head;
|
|
4006
|
-
|
|
4106
|
+
syntaxTree4(state2).iterate({
|
|
4007
4107
|
enter: (node) => {
|
|
4008
4108
|
if (node.name === "Image") {
|
|
4009
4109
|
const urlNode = node.node.getChild("URL");
|
|
@@ -4043,11 +4143,11 @@ var imageUpload = (options = {}) => {
|
|
|
4043
4143
|
};
|
|
4044
4144
|
|
|
4045
4145
|
// packages/ui/react-ui-editor/src/extensions/markdown/link.ts
|
|
4046
|
-
import { syntaxTree as
|
|
4146
|
+
import { syntaxTree as syntaxTree5 } from "@codemirror/language";
|
|
4047
4147
|
import { hoverTooltip as hoverTooltip2 } from "@codemirror/view";
|
|
4048
4148
|
import { tooltipContent } from "@dxos/react-ui-theme";
|
|
4049
4149
|
var linkTooltip = (render) => hoverTooltip2((view, pos, side) => {
|
|
4050
|
-
const syntax =
|
|
4150
|
+
const syntax = syntaxTree5(view.state).resolveInner(pos, side);
|
|
4051
4151
|
let link = null;
|
|
4052
4152
|
for (let i = 0, node = syntax; !link && node && i < 5; node = node.parent, i++) {
|
|
4053
4153
|
link = node.name === "Link" ? node : null;
|
|
@@ -4077,7 +4177,7 @@ var linkTooltip = (render) => hoverTooltip2((view, pos, side) => {
|
|
|
4077
4177
|
});
|
|
4078
4178
|
|
|
4079
4179
|
// packages/ui/react-ui-editor/src/extensions/markdown/table.ts
|
|
4080
|
-
import { syntaxTree as
|
|
4180
|
+
import { syntaxTree as syntaxTree6 } from "@codemirror/language";
|
|
4081
4181
|
import { RangeSetBuilder as RangeSetBuilder3, StateField as StateField6 } from "@codemirror/state";
|
|
4082
4182
|
import { Decoration as Decoration7, EditorView as EditorView14, WidgetType as WidgetType5 } from "@codemirror/view";
|
|
4083
4183
|
var table = (options = {}) => {
|
|
@@ -4096,7 +4196,7 @@ var update = (state2, options) => {
|
|
|
4096
4196
|
const table2 = getTable();
|
|
4097
4197
|
return table2.rows?.[table2.rows.length - 1];
|
|
4098
4198
|
};
|
|
4099
|
-
|
|
4199
|
+
syntaxTree6(state2).iterate({
|
|
4100
4200
|
enter: (node) => {
|
|
4101
4201
|
switch (node.name) {
|
|
4102
4202
|
case "Table": {
|
|
@@ -4181,7 +4281,7 @@ var TableWidget = class extends WidgetType5 {
|
|
|
4181
4281
|
// packages/ui/react-ui-editor/src/extensions/mention.ts
|
|
4182
4282
|
import { autocompletion as autocompletion2 } from "@codemirror/autocomplete";
|
|
4183
4283
|
import { log as log6 } from "@dxos/log";
|
|
4184
|
-
var
|
|
4284
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/mention.ts";
|
|
4185
4285
|
var mention = ({ onSearch }) => {
|
|
4186
4286
|
return autocompletion2({
|
|
4187
4287
|
// TODO(burdon): Not working.
|
|
@@ -4196,7 +4296,7 @@ var mention = ({ onSearch }) => {
|
|
|
4196
4296
|
log6.info("completion context", {
|
|
4197
4297
|
context
|
|
4198
4298
|
}, {
|
|
4199
|
-
F:
|
|
4299
|
+
F: __dxlog_file9,
|
|
4200
4300
|
L: 26,
|
|
4201
4301
|
S: void 0,
|
|
4202
4302
|
C: (f, a) => f(...a)
|
|
@@ -4256,18 +4356,18 @@ var EditorModes = {
|
|
|
4256
4356
|
};
|
|
4257
4357
|
|
|
4258
4358
|
// packages/ui/react-ui-editor/src/extensions/state.ts
|
|
4259
|
-
import { Transaction } from "@codemirror/state";
|
|
4359
|
+
import { Transaction as Transaction2 } from "@codemirror/state";
|
|
4260
4360
|
import { EditorView as EditorView15, keymap as keymap9 } from "@codemirror/view";
|
|
4261
4361
|
import { debounce as debounce2 } from "@dxos/async";
|
|
4262
4362
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
4263
4363
|
import { isNotFalsy as isNotFalsy3 } from "@dxos/util";
|
|
4264
|
-
var
|
|
4364
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/extensions/state.ts";
|
|
4265
4365
|
var scrollAnnotation = "dxos.org/cm/scrolling";
|
|
4266
4366
|
var keyPrefix = "dxos.org/react-ui-editor/state";
|
|
4267
4367
|
var localStorageStateStoreAdapter = {
|
|
4268
4368
|
setState: (id, state2) => {
|
|
4269
4369
|
invariant4(id, void 0, {
|
|
4270
|
-
F:
|
|
4370
|
+
F: __dxlog_file10,
|
|
4271
4371
|
L: 35,
|
|
4272
4372
|
S: void 0,
|
|
4273
4373
|
A: [
|
|
@@ -4279,7 +4379,7 @@ var localStorageStateStoreAdapter = {
|
|
|
4279
4379
|
},
|
|
4280
4380
|
getState: (id) => {
|
|
4281
4381
|
invariant4(id, void 0, {
|
|
4282
|
-
F:
|
|
4382
|
+
F: __dxlog_file10,
|
|
4283
4383
|
L: 39,
|
|
4284
4384
|
S: void 0,
|
|
4285
4385
|
A: [
|
|
@@ -4332,7 +4432,7 @@ var state = ({ getState, setState } = {}) => {
|
|
|
4332
4432
|
yMargin: 0
|
|
4333
4433
|
}),
|
|
4334
4434
|
selection: state2.selection,
|
|
4335
|
-
annotations:
|
|
4435
|
+
annotations: Transaction2.userEvent.of(scrollAnnotation)
|
|
4336
4436
|
});
|
|
4337
4437
|
}
|
|
4338
4438
|
return true;
|
|
@@ -4400,7 +4500,7 @@ var typewriter = ({ delay = 75, items = defaultItems } = {}) => {
|
|
|
4400
4500
|
};
|
|
4401
4501
|
|
|
4402
4502
|
// packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx
|
|
4403
|
-
var
|
|
4503
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx";
|
|
4404
4504
|
var instanceCount = 0;
|
|
4405
4505
|
var TextEditor = /* @__PURE__ */ forwardRef(({
|
|
4406
4506
|
id,
|
|
@@ -4440,7 +4540,7 @@ var TextEditor = /* @__PURE__ */ forwardRef(({
|
|
|
4440
4540
|
id,
|
|
4441
4541
|
instanceId
|
|
4442
4542
|
}, {
|
|
4443
|
-
F:
|
|
4543
|
+
F: __dxlog_file11,
|
|
4444
4544
|
L: 91,
|
|
4445
4545
|
S: void 0,
|
|
4446
4546
|
C: (f, a) => f(...a)
|
|
@@ -4452,7 +4552,7 @@ var TextEditor = /* @__PURE__ */ forwardRef(({
|
|
|
4452
4552
|
// TODO(burdon): NOTE: Doesn't catch errors in keymap functions.
|
|
4453
4553
|
EditorView16.exceptionSink.of((err) => {
|
|
4454
4554
|
log7.catch(err, void 0, {
|
|
4455
|
-
F:
|
|
4555
|
+
F: __dxlog_file11,
|
|
4456
4556
|
L: 104,
|
|
4457
4557
|
S: void 0,
|
|
4458
4558
|
C: (f, a) => f(...a)
|
|
@@ -4499,7 +4599,7 @@ var TextEditor = /* @__PURE__ */ forwardRef(({
|
|
|
4499
4599
|
id,
|
|
4500
4600
|
instanceId
|
|
4501
4601
|
}, {
|
|
4502
|
-
F:
|
|
4602
|
+
F: __dxlog_file11,
|
|
4503
4603
|
L: 153,
|
|
4504
4604
|
S: void 0,
|
|
4505
4605
|
C: (f, a) => f(...a)
|
|
@@ -4856,7 +4956,7 @@ import { useFocusableGroup as useFocusableGroup2 } from "@fluentui/react-tabster
|
|
|
4856
4956
|
import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
4857
4957
|
import { log as log8 } from "@dxos/log";
|
|
4858
4958
|
import { isNotFalsy as isNotFalsy5 } from "@dxos/util";
|
|
4859
|
-
var
|
|
4959
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-editor/src/hooks/useTextEditor.ts";
|
|
4860
4960
|
var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
4861
4961
|
let { id, doc, selection, extensions, autoFocus, scrollTo, debug } = useMemo2(cb, deps ?? []);
|
|
4862
4962
|
const onUpdate = useRef3();
|
|
@@ -4868,7 +4968,7 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4868
4968
|
log8("create", {
|
|
4869
4969
|
id
|
|
4870
4970
|
}, {
|
|
4871
|
-
F:
|
|
4971
|
+
F: __dxlog_file12,
|
|
4872
4972
|
L: 50,
|
|
4873
4973
|
S: void 0,
|
|
4874
4974
|
C: (f, a) => f(...a)
|
|
@@ -4880,7 +4980,7 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4880
4980
|
// TODO(burdon): Doesn't catch errors in keymap functions.
|
|
4881
4981
|
EditorView17.exceptionSink.of((err) => {
|
|
4882
4982
|
log8.catch(err, void 0, {
|
|
4883
|
-
F:
|
|
4983
|
+
F: __dxlog_file12,
|
|
4884
4984
|
L: 60,
|
|
4885
4985
|
S: void 0,
|
|
4886
4986
|
C: (f, a) => f(...a)
|
|
@@ -4911,7 +5011,7 @@ var useTextEditor = (cb = () => ({}), deps = []) => {
|
|
|
4911
5011
|
log8("destroy", {
|
|
4912
5012
|
id
|
|
4913
5013
|
}, {
|
|
4914
|
-
F:
|
|
5014
|
+
F: __dxlog_file12,
|
|
4915
5015
|
L: 88,
|
|
4916
5016
|
S: void 0,
|
|
4917
5017
|
C: (f, a) => f(...a)
|