@liveblocks/react-tiptap 2.15.1 → 2.16.0-toolbars1
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/LiveblocksExtension.js +1 -1
- package/dist/LiveblocksExtension.js.map +1 -1
- package/dist/LiveblocksExtension.mjs +1 -1
- package/dist/LiveblocksExtension.mjs.map +1 -1
- package/dist/comments/AnchoredThreads.js +34 -16
- package/dist/comments/AnchoredThreads.js.map +1 -1
- package/dist/comments/AnchoredThreads.mjs +33 -15
- package/dist/comments/AnchoredThreads.mjs.map +1 -1
- package/dist/comments/CommentsExtension.js +6 -2
- package/dist/comments/CommentsExtension.js.map +1 -1
- package/dist/comments/CommentsExtension.mjs +7 -3
- package/dist/comments/CommentsExtension.mjs.map +1 -1
- package/dist/comments/FloatingComposer.js +34 -33
- package/dist/comments/FloatingComposer.js.map +1 -1
- package/dist/comments/FloatingComposer.mjs +36 -35
- package/dist/comments/FloatingComposer.mjs.map +1 -1
- package/dist/comments/FloatingThreads.js +5 -2
- package/dist/comments/FloatingThreads.js.map +1 -1
- package/dist/comments/FloatingThreads.mjs +5 -2
- package/dist/comments/FloatingThreads.mjs.map +1 -1
- package/dist/context.js +24 -0
- package/dist/context.js.map +1 -0
- package/dist/context.mjs +21 -0
- package/dist/context.mjs.map +1 -0
- package/dist/index.d.mts +65 -13
- package/dist/index.d.ts +65 -13
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mentions/MentionsList.js +117 -107
- package/dist/mentions/MentionsList.js.map +1 -1
- package/dist/mentions/MentionsList.mjs +119 -109
- package/dist/mentions/MentionsList.mjs.map +1 -1
- package/dist/toolbar/FloatingToolbar.js +301 -0
- package/dist/toolbar/FloatingToolbar.js.map +1 -0
- package/dist/toolbar/FloatingToolbar.mjs +298 -0
- package/dist/toolbar/FloatingToolbar.mjs.map +1 -0
- package/dist/toolbar/FloatingToolbarContext.js +8 -0
- package/dist/toolbar/FloatingToolbarContext.js.map +1 -0
- package/dist/toolbar/FloatingToolbarContext.mjs +6 -0
- package/dist/toolbar/FloatingToolbarContext.mjs.map +1 -0
- package/dist/toolbar/Toolbar.js +352 -0
- package/dist/toolbar/Toolbar.js.map +1 -0
- package/dist/toolbar/Toolbar.mjs +327 -0
- package/dist/toolbar/Toolbar.mjs.map +1 -0
- package/dist/types.js +7 -3
- package/dist/types.js.map +1 -1
- package/dist/types.mjs +6 -3
- package/dist/types.mjs.map +1 -1
- package/dist/utils.js +17 -0
- package/dist/utils.js.map +1 -1
- package/dist/utils.mjs +16 -1
- package/dist/utils.mjs.map +1 -1
- package/dist/version-history/HistoryVersionPreview.js +79 -79
- package/dist/version-history/HistoryVersionPreview.js.map +1 -1
- package/dist/version-history/HistoryVersionPreview.mjs +79 -79
- package/dist/version-history/HistoryVersionPreview.mjs.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +11 -8
- package/src/styles/constants.css +2 -1
- package/src/styles/index.css +58 -6
- package/src/styles/utils.css +11 -0
- package/styles.css +1 -1
- package/styles.css.map +1 -1
|
@@ -11,87 +11,87 @@ var yjs = require('yjs');
|
|
|
11
11
|
var classnames = require('../classnames.js');
|
|
12
12
|
|
|
13
13
|
const AUTHORS_TRUNCATE = 3;
|
|
14
|
-
const HistoryVersionPreview = react.forwardRef(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
onClick: restore,
|
|
75
|
-
disabled: !data,
|
|
76
|
-
variant: "primary",
|
|
77
|
-
size: "large",
|
|
78
|
-
className: "lb-history-version-preview-action",
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ jsxRuntime.jsx(_private.RestoreIcon, {
|
|
81
|
-
className: "lb-button-icon"
|
|
82
|
-
}),
|
|
83
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
84
|
-
className: "lb-button-label",
|
|
85
|
-
children: $.HISTORY_VERSION_PREVIEW_RESTORE
|
|
14
|
+
const HistoryVersionPreview = react.forwardRef(
|
|
15
|
+
({ version, editor: parentEditor, onVersionRestore, className, ...props }, forwardedRef) => {
|
|
16
|
+
const $ = reactUi.useOverrides();
|
|
17
|
+
const { isLoading, data, error } = react$1.useHistoryVersionData(version.id);
|
|
18
|
+
const previewEditor = react$2.useEditor({
|
|
19
|
+
editable: false,
|
|
20
|
+
extensions: parentEditor.extensionManager.extensions.filter(
|
|
21
|
+
(e) => e.type !== "extension"
|
|
22
|
+
)
|
|
23
|
+
});
|
|
24
|
+
react.useEffect(() => {
|
|
25
|
+
if (data && previewEditor) {
|
|
26
|
+
const doc = new yjs.Doc();
|
|
27
|
+
yjs.applyUpdate(doc, data);
|
|
28
|
+
const root = doc.getXmlFragment("default");
|
|
29
|
+
const node = yProsemirror.yXmlFragmentToProseMirrorRootNode(
|
|
30
|
+
root,
|
|
31
|
+
parentEditor.schema
|
|
32
|
+
);
|
|
33
|
+
previewEditor.commands.setContent(node.toJSON());
|
|
34
|
+
}
|
|
35
|
+
}, [data, previewEditor, parentEditor]);
|
|
36
|
+
const restore = react.useCallback(() => {
|
|
37
|
+
parentEditor.commands.setContent(previewEditor?.getJSON() ?? "");
|
|
38
|
+
onVersionRestore?.(version);
|
|
39
|
+
}, [onVersionRestore, parentEditor, previewEditor, version]);
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
41
|
+
...props,
|
|
42
|
+
className: classnames.classNames(
|
|
43
|
+
"lb-root lb-history-version-preview lb-tiptap-version-preview",
|
|
44
|
+
className
|
|
45
|
+
),
|
|
46
|
+
ref: forwardedRef,
|
|
47
|
+
children: [
|
|
48
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
49
|
+
className: "lb-loading lb-history-version-preview-loading",
|
|
50
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(_private.SpinnerIcon, {})
|
|
51
|
+
}) : error ? /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
52
|
+
className: "lb-error lb-history-version-preview-error",
|
|
53
|
+
children: $.HISTORY_VERSION_PREVIEW_ERROR(error)
|
|
54
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
55
|
+
className: "lb-history-version-preview-content lb-tiptap-editor-container lb-tiptap-version-preview-editor-container",
|
|
56
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$2.EditorContent, {
|
|
57
|
+
editor: previewEditor
|
|
58
|
+
})
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
61
|
+
className: "lb-history-version-preview-footer",
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
64
|
+
className: "lb-history-version-preview-authors",
|
|
65
|
+
children: $.HISTORY_VERSION_PREVIEW_AUTHORS_LIST(
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx(_private.List, {
|
|
67
|
+
values: version.authors.map((author) => /* @__PURE__ */ jsxRuntime.jsx(_private.User, {
|
|
68
|
+
userId: author.id,
|
|
69
|
+
replaceSelf: true
|
|
70
|
+
}, author.id)),
|
|
71
|
+
formatRemaining: $.LIST_REMAINING_USERS,
|
|
72
|
+
truncate: AUTHORS_TRUNCATE,
|
|
73
|
+
locale: $.locale
|
|
86
74
|
})
|
|
87
|
-
|
|
75
|
+
)
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
78
|
+
className: "lb-history-version-preview-actions",
|
|
79
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(_private.Button, {
|
|
80
|
+
onClick: restore,
|
|
81
|
+
disabled: !data,
|
|
82
|
+
variant: "primary",
|
|
83
|
+
size: "large",
|
|
84
|
+
className: "lb-history-version-preview-action",
|
|
85
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(_private.RestoreIcon, {}),
|
|
86
|
+
children: $.HISTORY_VERSION_PREVIEW_RESTORE
|
|
87
|
+
})
|
|
88
88
|
})
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
89
|
+
]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
95
|
|
|
96
96
|
exports.HistoryVersionPreview = HistoryVersionPreview;
|
|
97
97
|
//# sourceMappingURL=HistoryVersionPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistoryVersionPreview.js","sources":["../../src/version-history/HistoryVersionPreview.tsx"],"sourcesContent":["import type { HistoryVersion } from \"@liveblocks/core\";\nimport { useHistoryVersionData } from \"@liveblocks/react\";\nimport { useOverrides } from \"@liveblocks/react-ui\";\nimport {\n Button,\n List,\n RestoreIcon,\n SpinnerIcon,\n User,\n} from \"@liveblocks/react-ui/_private\";\nimport type { Content, Editor } from \"@tiptap/react\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport { forwardRef, useCallback, useEffect } from \"react\";\nimport { yXmlFragmentToProseMirrorRootNode } from \"y-prosemirror\";\nimport { applyUpdate, Doc } from \"yjs\";\n\nimport { classNames } from \"../classnames\";\n\nconst AUTHORS_TRUNCATE = 3;\n\nexport interface HistoryVersionPreviewProps\n extends ComponentPropsWithoutRef<\"div\"> {\n version: HistoryVersion;\n editor: Editor;\n onVersionRestore?: (version: HistoryVersion) => void;\n}\n\n/**\n * Displays a specific version of the current TipTap document.\n *\n * @example\n * <HistoryVersionPreview version={version} />\n */\nexport const HistoryVersionPreview = forwardRef<\n HTMLDivElement,\n HistoryVersionPreviewProps\n>(({ version, editor: parentEditor, onVersionRestore, className, ...props }
|
|
1
|
+
{"version":3,"file":"HistoryVersionPreview.js","sources":["../../src/version-history/HistoryVersionPreview.tsx"],"sourcesContent":["import type { HistoryVersion } from \"@liveblocks/core\";\nimport { useHistoryVersionData } from \"@liveblocks/react\";\nimport { useOverrides } from \"@liveblocks/react-ui\";\nimport {\n Button,\n List,\n RestoreIcon,\n SpinnerIcon,\n User,\n} from \"@liveblocks/react-ui/_private\";\nimport type { Content, Editor } from \"@tiptap/react\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport { forwardRef, useCallback, useEffect } from \"react\";\nimport { yXmlFragmentToProseMirrorRootNode } from \"y-prosemirror\";\nimport { applyUpdate, Doc } from \"yjs\";\n\nimport { classNames } from \"../classnames\";\n\nconst AUTHORS_TRUNCATE = 3;\n\nexport interface HistoryVersionPreviewProps\n extends ComponentPropsWithoutRef<\"div\"> {\n version: HistoryVersion;\n editor: Editor;\n onVersionRestore?: (version: HistoryVersion) => void;\n}\n\n/**\n * Displays a specific version of the current TipTap document.\n *\n * @example\n * <HistoryVersionPreview version={version} />\n */\nexport const HistoryVersionPreview = forwardRef<\n HTMLDivElement,\n HistoryVersionPreviewProps\n>(\n (\n { version, editor: parentEditor, onVersionRestore, className, ...props },\n forwardedRef\n ) => {\n const $ = useOverrides();\n const { isLoading, data, error } = useHistoryVersionData(version.id);\n\n const previewEditor = useEditor({\n // ignore extensions, only get marks/nodes\n editable: false,\n extensions: parentEditor.extensionManager.extensions.filter(\n (e) => e.type !== \"extension\"\n ),\n });\n useEffect(() => {\n if (data && previewEditor) {\n const doc = new Doc();\n applyUpdate(doc, data);\n const root = doc.getXmlFragment(\"default\"); // TODO: lookup field\n const node = yXmlFragmentToProseMirrorRootNode(\n root,\n parentEditor.schema\n );\n previewEditor.commands.setContent(node.toJSON() as Content);\n }\n }, [data, previewEditor, parentEditor]);\n const restore = useCallback(() => {\n parentEditor.commands.setContent(previewEditor?.getJSON() ?? \"\");\n onVersionRestore?.(version);\n }, [onVersionRestore, parentEditor, previewEditor, version]);\n\n return (\n <div\n {...props}\n className={classNames(\n \"lb-root lb-history-version-preview lb-tiptap-version-preview\",\n className\n )}\n ref={forwardedRef}\n >\n {isLoading ? (\n <div className=\"lb-loading lb-history-version-preview-loading\">\n <SpinnerIcon />\n </div>\n ) : error ? (\n <div className=\"lb-error lb-history-version-preview-error\">\n {$.HISTORY_VERSION_PREVIEW_ERROR(error)}\n </div>\n ) : (\n <div className=\"lb-history-version-preview-content lb-tiptap-editor-container lb-tiptap-version-preview-editor-container\">\n <EditorContent editor={previewEditor} />\n </div>\n )}\n <div className=\"lb-history-version-preview-footer\">\n <span className=\"lb-history-version-preview-authors\">\n {$.HISTORY_VERSION_PREVIEW_AUTHORS_LIST(\n <List\n values={version.authors.map((author) => (\n <User key={author.id} userId={author.id} replaceSelf />\n ))}\n formatRemaining={$.LIST_REMAINING_USERS}\n truncate={AUTHORS_TRUNCATE}\n locale={$.locale}\n />\n )}\n </span>\n <div className=\"lb-history-version-preview-actions\">\n <Button\n onClick={restore}\n disabled={!data}\n variant=\"primary\"\n size=\"large\"\n className=\"lb-history-version-preview-action\"\n icon={<RestoreIcon />}\n >\n {$.HISTORY_VERSION_PREVIEW_RESTORE}\n </Button>\n </div>\n </div>\n </div>\n );\n }\n);\n"],"names":["forwardRef","useOverrides","useHistoryVersionData","useEditor","useEffect","Doc","applyUpdate","yXmlFragmentToProseMirrorRootNode","useCallback","jsxs","classNames","jsx","SpinnerIcon","EditorContent","List","User","Button","RestoreIcon"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,gBAAmB,GAAA,CAAA,CAAA;AAelB,MAAM,qBAAwB,GAAAA,gBAAA;AAAA,EAInC,CACE,EAAE,OAAS,EAAA,MAAA,EAAQ,cAAc,gBAAkB,EAAA,SAAA,EAAA,GAAc,KAAM,EAAA,EACvE,YACG,KAAA;AACH,IAAA,MAAM,IAAIC,oBAAa,EAAA,CAAA;AACvB,IAAA,MAAM,EAAE,SAAW,EAAA,IAAA,EAAM,OAAU,GAAAC,6BAAA,CAAsB,QAAQ,EAAE,CAAA,CAAA;AAEnE,IAAA,MAAM,gBAAgBC,iBAAU,CAAA;AAAA,MAE9B,QAAU,EAAA,KAAA;AAAA,MACV,UAAA,EAAY,YAAa,CAAA,gBAAA,CAAiB,UAAW,CAAA,MAAA;AAAA,QACnD,CAAC,CAAM,KAAA,CAAA,CAAE,IAAS,KAAA,WAAA;AAAA,OACpB;AAAA,KACD,CAAA,CAAA;AACD,IAAAC,eAAA,CAAU,MAAM;AACd,MAAA,IAAI,QAAQ,aAAe,EAAA;AACzB,QAAM,MAAA,GAAA,GAAM,IAAIC,OAAI,EAAA,CAAA;AACpB,QAAAC,eAAA,CAAY,KAAK,IAAI,CAAA,CAAA;AACrB,QAAM,MAAA,IAAA,GAAO,GAAI,CAAA,cAAA,CAAe,SAAS,CAAA,CAAA;AACzC,QAAA,MAAM,IAAO,GAAAC,8CAAA;AAAA,UACX,IAAA;AAAA,UACA,YAAa,CAAA,MAAA;AAAA,SACf,CAAA;AACA,QAAA,aAAA,CAAc,QAAS,CAAA,UAAA,CAAW,IAAK,CAAA,MAAA,EAAmB,CAAA,CAAA;AAAA,OAC5D;AAAA,KACC,EAAA,CAAC,IAAM,EAAA,aAAA,EAAe,YAAY,CAAC,CAAA,CAAA;AACtC,IAAM,MAAA,OAAA,GAAUC,kBAAY,MAAM;AAChC,MAAA,YAAA,CAAa,QAAS,CAAA,UAAA,CAAW,aAAe,EAAA,OAAA,MAAa,EAAE,CAAA,CAAA;AAC/D,MAAA,gBAAA,GAAmB,OAAO,CAAA,CAAA;AAAA,OACzB,CAAC,gBAAA,EAAkB,YAAc,EAAA,aAAA,EAAe,OAAO,CAAC,CAAA,CAAA;AAE3D,IAAA,uBACGC,eAAA,CAAA,KAAA,EAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAW,EAAAC,qBAAA;AAAA,QACT,8DAAA;AAAA,QACA,SAAA;AAAA,OACF;AAAA,MACA,GAAK,EAAA,YAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,QAAA,SAAA,mBACEC,cAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,+CAAA;AAAA,UACb,yCAACC,oBAAY,EAAA,EAAA,CAAA;AAAA,SACf,CAAA,GACE,wBACDD,cAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,2CAAA;AAAA,UACZ,QAAA,EAAA,CAAA,CAAE,8BAA8B,KAAK,CAAA;AAAA,SACxC,oBAECA,cAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,0GAAA;AAAA,UACb,QAAC,kBAAAA,cAAA,CAAAE,qBAAA,EAAA;AAAA,YAAc,MAAQ,EAAA,aAAA;AAAA,WAAe,CAAA;AAAA,SACxC,CAAA;AAAA,wBAEDJ,eAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,mCAAA;AAAA,UACb,QAAA,EAAA;AAAA,4BAACE,cAAA,CAAA,MAAA,EAAA;AAAA,cAAK,SAAU,EAAA,oCAAA;AAAA,cACb,QAAE,EAAA,CAAA,CAAA,oCAAA;AAAA,gCACAA,cAAA,CAAAG,aAAA,EAAA;AAAA,kBACC,QAAQ,OAAQ,CAAA,OAAA,CAAQ,GAAI,CAAA,CAAC,2BAC1BH,cAAA,CAAAI,aAAA,EAAA;AAAA,oBAAqB,QAAQ,MAAO,CAAA,EAAA;AAAA,oBAAI,WAAW,EAAA,IAAA;AAAA,mBAAzC,EAAA,MAAA,CAAO,EAAmC,CACtD,CAAA;AAAA,kBACD,iBAAiB,CAAE,CAAA,oBAAA;AAAA,kBACnB,QAAU,EAAA,gBAAA;AAAA,kBACV,QAAQ,CAAE,CAAA,MAAA;AAAA,iBACZ,CAAA;AAAA,eACF;AAAA,aACF,CAAA;AAAA,4BACCJ,cAAA,CAAA,KAAA,EAAA;AAAA,cAAI,SAAU,EAAA,oCAAA;AAAA,cACb,QAAC,kBAAAA,cAAA,CAAAK,eAAA,EAAA;AAAA,gBACC,OAAS,EAAA,OAAA;AAAA,gBACT,UAAU,CAAC,IAAA;AAAA,gBACX,OAAQ,EAAA,SAAA;AAAA,gBACR,IAAK,EAAA,OAAA;AAAA,gBACL,SAAU,EAAA,mCAAA;AAAA,gBACV,IAAA,iCAAOC,oBAAY,EAAA,EAAA,CAAA;AAAA,gBAElB,QAAE,EAAA,CAAA,CAAA,+BAAA;AAAA,eACL,CAAA;AAAA,aACF,CAAA;AAAA,WAAA;AAAA,SACF,CAAA;AAAA,OAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -9,87 +9,87 @@ import { Doc, applyUpdate } from 'yjs';
|
|
|
9
9
|
import { classNames } from '../classnames.mjs';
|
|
10
10
|
|
|
11
11
|
const AUTHORS_TRUNCATE = 3;
|
|
12
|
-
const HistoryVersionPreview = forwardRef(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
onClick: restore,
|
|
73
|
-
disabled: !data,
|
|
74
|
-
variant: "primary",
|
|
75
|
-
size: "large",
|
|
76
|
-
className: "lb-history-version-preview-action",
|
|
77
|
-
children: [
|
|
78
|
-
/* @__PURE__ */ jsx(RestoreIcon, {
|
|
79
|
-
className: "lb-button-icon"
|
|
80
|
-
}),
|
|
81
|
-
/* @__PURE__ */ jsx("span", {
|
|
82
|
-
className: "lb-button-label",
|
|
83
|
-
children: $.HISTORY_VERSION_PREVIEW_RESTORE
|
|
12
|
+
const HistoryVersionPreview = forwardRef(
|
|
13
|
+
({ version, editor: parentEditor, onVersionRestore, className, ...props }, forwardedRef) => {
|
|
14
|
+
const $ = useOverrides();
|
|
15
|
+
const { isLoading, data, error } = useHistoryVersionData(version.id);
|
|
16
|
+
const previewEditor = useEditor({
|
|
17
|
+
editable: false,
|
|
18
|
+
extensions: parentEditor.extensionManager.extensions.filter(
|
|
19
|
+
(e) => e.type !== "extension"
|
|
20
|
+
)
|
|
21
|
+
});
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (data && previewEditor) {
|
|
24
|
+
const doc = new Doc();
|
|
25
|
+
applyUpdate(doc, data);
|
|
26
|
+
const root = doc.getXmlFragment("default");
|
|
27
|
+
const node = yXmlFragmentToProseMirrorRootNode(
|
|
28
|
+
root,
|
|
29
|
+
parentEditor.schema
|
|
30
|
+
);
|
|
31
|
+
previewEditor.commands.setContent(node.toJSON());
|
|
32
|
+
}
|
|
33
|
+
}, [data, previewEditor, parentEditor]);
|
|
34
|
+
const restore = useCallback(() => {
|
|
35
|
+
parentEditor.commands.setContent(previewEditor?.getJSON() ?? "");
|
|
36
|
+
onVersionRestore?.(version);
|
|
37
|
+
}, [onVersionRestore, parentEditor, previewEditor, version]);
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
...props,
|
|
40
|
+
className: classNames(
|
|
41
|
+
"lb-root lb-history-version-preview lb-tiptap-version-preview",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
44
|
+
ref: forwardedRef,
|
|
45
|
+
children: [
|
|
46
|
+
isLoading ? /* @__PURE__ */ jsx("div", {
|
|
47
|
+
className: "lb-loading lb-history-version-preview-loading",
|
|
48
|
+
children: /* @__PURE__ */ jsx(SpinnerIcon, {})
|
|
49
|
+
}) : error ? /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: "lb-error lb-history-version-preview-error",
|
|
51
|
+
children: $.HISTORY_VERSION_PREVIEW_ERROR(error)
|
|
52
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
53
|
+
className: "lb-history-version-preview-content lb-tiptap-editor-container lb-tiptap-version-preview-editor-container",
|
|
54
|
+
children: /* @__PURE__ */ jsx(EditorContent, {
|
|
55
|
+
editor: previewEditor
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: "lb-history-version-preview-footer",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx("span", {
|
|
62
|
+
className: "lb-history-version-preview-authors",
|
|
63
|
+
children: $.HISTORY_VERSION_PREVIEW_AUTHORS_LIST(
|
|
64
|
+
/* @__PURE__ */ jsx(List, {
|
|
65
|
+
values: version.authors.map((author) => /* @__PURE__ */ jsx(User, {
|
|
66
|
+
userId: author.id,
|
|
67
|
+
replaceSelf: true
|
|
68
|
+
}, author.id)),
|
|
69
|
+
formatRemaining: $.LIST_REMAINING_USERS,
|
|
70
|
+
truncate: AUTHORS_TRUNCATE,
|
|
71
|
+
locale: $.locale
|
|
84
72
|
})
|
|
85
|
-
|
|
73
|
+
)
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ jsx("div", {
|
|
76
|
+
className: "lb-history-version-preview-actions",
|
|
77
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
78
|
+
onClick: restore,
|
|
79
|
+
disabled: !data,
|
|
80
|
+
variant: "primary",
|
|
81
|
+
size: "large",
|
|
82
|
+
className: "lb-history-version-preview-action",
|
|
83
|
+
icon: /* @__PURE__ */ jsx(RestoreIcon, {}),
|
|
84
|
+
children: $.HISTORY_VERSION_PREVIEW_RESTORE
|
|
85
|
+
})
|
|
86
86
|
})
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
93
|
|
|
94
94
|
export { HistoryVersionPreview };
|
|
95
95
|
//# sourceMappingURL=HistoryVersionPreview.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistoryVersionPreview.mjs","sources":["../../src/version-history/HistoryVersionPreview.tsx"],"sourcesContent":["import type { HistoryVersion } from \"@liveblocks/core\";\nimport { useHistoryVersionData } from \"@liveblocks/react\";\nimport { useOverrides } from \"@liveblocks/react-ui\";\nimport {\n Button,\n List,\n RestoreIcon,\n SpinnerIcon,\n User,\n} from \"@liveblocks/react-ui/_private\";\nimport type { Content, Editor } from \"@tiptap/react\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport { forwardRef, useCallback, useEffect } from \"react\";\nimport { yXmlFragmentToProseMirrorRootNode } from \"y-prosemirror\";\nimport { applyUpdate, Doc } from \"yjs\";\n\nimport { classNames } from \"../classnames\";\n\nconst AUTHORS_TRUNCATE = 3;\n\nexport interface HistoryVersionPreviewProps\n extends ComponentPropsWithoutRef<\"div\"> {\n version: HistoryVersion;\n editor: Editor;\n onVersionRestore?: (version: HistoryVersion) => void;\n}\n\n/**\n * Displays a specific version of the current TipTap document.\n *\n * @example\n * <HistoryVersionPreview version={version} />\n */\nexport const HistoryVersionPreview = forwardRef<\n HTMLDivElement,\n HistoryVersionPreviewProps\n>(({ version, editor: parentEditor, onVersionRestore, className, ...props }
|
|
1
|
+
{"version":3,"file":"HistoryVersionPreview.mjs","sources":["../../src/version-history/HistoryVersionPreview.tsx"],"sourcesContent":["import type { HistoryVersion } from \"@liveblocks/core\";\nimport { useHistoryVersionData } from \"@liveblocks/react\";\nimport { useOverrides } from \"@liveblocks/react-ui\";\nimport {\n Button,\n List,\n RestoreIcon,\n SpinnerIcon,\n User,\n} from \"@liveblocks/react-ui/_private\";\nimport type { Content, Editor } from \"@tiptap/react\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport { forwardRef, useCallback, useEffect } from \"react\";\nimport { yXmlFragmentToProseMirrorRootNode } from \"y-prosemirror\";\nimport { applyUpdate, Doc } from \"yjs\";\n\nimport { classNames } from \"../classnames\";\n\nconst AUTHORS_TRUNCATE = 3;\n\nexport interface HistoryVersionPreviewProps\n extends ComponentPropsWithoutRef<\"div\"> {\n version: HistoryVersion;\n editor: Editor;\n onVersionRestore?: (version: HistoryVersion) => void;\n}\n\n/**\n * Displays a specific version of the current TipTap document.\n *\n * @example\n * <HistoryVersionPreview version={version} />\n */\nexport const HistoryVersionPreview = forwardRef<\n HTMLDivElement,\n HistoryVersionPreviewProps\n>(\n (\n { version, editor: parentEditor, onVersionRestore, className, ...props },\n forwardedRef\n ) => {\n const $ = useOverrides();\n const { isLoading, data, error } = useHistoryVersionData(version.id);\n\n const previewEditor = useEditor({\n // ignore extensions, only get marks/nodes\n editable: false,\n extensions: parentEditor.extensionManager.extensions.filter(\n (e) => e.type !== \"extension\"\n ),\n });\n useEffect(() => {\n if (data && previewEditor) {\n const doc = new Doc();\n applyUpdate(doc, data);\n const root = doc.getXmlFragment(\"default\"); // TODO: lookup field\n const node = yXmlFragmentToProseMirrorRootNode(\n root,\n parentEditor.schema\n );\n previewEditor.commands.setContent(node.toJSON() as Content);\n }\n }, [data, previewEditor, parentEditor]);\n const restore = useCallback(() => {\n parentEditor.commands.setContent(previewEditor?.getJSON() ?? \"\");\n onVersionRestore?.(version);\n }, [onVersionRestore, parentEditor, previewEditor, version]);\n\n return (\n <div\n {...props}\n className={classNames(\n \"lb-root lb-history-version-preview lb-tiptap-version-preview\",\n className\n )}\n ref={forwardedRef}\n >\n {isLoading ? (\n <div className=\"lb-loading lb-history-version-preview-loading\">\n <SpinnerIcon />\n </div>\n ) : error ? (\n <div className=\"lb-error lb-history-version-preview-error\">\n {$.HISTORY_VERSION_PREVIEW_ERROR(error)}\n </div>\n ) : (\n <div className=\"lb-history-version-preview-content lb-tiptap-editor-container lb-tiptap-version-preview-editor-container\">\n <EditorContent editor={previewEditor} />\n </div>\n )}\n <div className=\"lb-history-version-preview-footer\">\n <span className=\"lb-history-version-preview-authors\">\n {$.HISTORY_VERSION_PREVIEW_AUTHORS_LIST(\n <List\n values={version.authors.map((author) => (\n <User key={author.id} userId={author.id} replaceSelf />\n ))}\n formatRemaining={$.LIST_REMAINING_USERS}\n truncate={AUTHORS_TRUNCATE}\n locale={$.locale}\n />\n )}\n </span>\n <div className=\"lb-history-version-preview-actions\">\n <Button\n onClick={restore}\n disabled={!data}\n variant=\"primary\"\n size=\"large\"\n className=\"lb-history-version-preview-action\"\n icon={<RestoreIcon />}\n >\n {$.HISTORY_VERSION_PREVIEW_RESTORE}\n </Button>\n </div>\n </div>\n </div>\n );\n }\n);\n"],"names":[],"mappings":"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"}
|
package/dist/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const PKG_NAME = "@liveblocks/react-tiptap";
|
|
4
|
-
const PKG_VERSION = typeof "2.
|
|
4
|
+
const PKG_VERSION = typeof "2.16.0-toolbars1" === "string" && "2.16.0-toolbars1";
|
|
5
5
|
const PKG_FORMAT = typeof "cjs" === "string" && "cjs";
|
|
6
6
|
|
|
7
7
|
exports.PKG_FORMAT = PKG_FORMAT;
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-tiptap\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,2BAAA;AACX,MAAA,WAAA,GAAc,OAAO,
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-tiptap\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,2BAAA;AACX,MAAA,WAAA,GAAc,OAAO,kBAAA,KAAgB,QAAY,IAAA,mBAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;;;"}
|
package/dist/version.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const PKG_NAME = "@liveblocks/react-tiptap";
|
|
2
|
-
const PKG_VERSION = typeof "2.
|
|
2
|
+
const PKG_VERSION = typeof "2.16.0-toolbars1" === "string" && "2.16.0-toolbars1";
|
|
3
3
|
const PKG_FORMAT = typeof "esm" === "string" && "esm";
|
|
4
4
|
|
|
5
5
|
export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
|
package/dist/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-tiptap\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,2BAAA;AACX,MAAA,WAAA,GAAc,OAAO,
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const ROLLUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-tiptap\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof ROLLUP_FORMAT === \"string\" && ROLLUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,2BAAA;AACX,MAAA,WAAA,GAAc,OAAO,kBAAA,KAAgB,QAAY,IAAA,mBAAA;AACjD,MAAA,UAAA,GAAa,OAAO,KAAA,KAAkB,QAAY,IAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/react-tiptap",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0-toolbars1",
|
|
4
4
|
"description": "A tiptap react plugin to enable collaboration, comments, live cursors, and more.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -42,14 +42,17 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@floating-ui/react-dom": "^2.1.2",
|
|
45
|
-
"@liveblocks/client": "2.
|
|
46
|
-
"@liveblocks/core": "2.
|
|
47
|
-
"@liveblocks/react": "2.
|
|
48
|
-
"@liveblocks/react-ui": "2.
|
|
49
|
-
"@liveblocks/yjs": "2.
|
|
45
|
+
"@liveblocks/client": "2.16.0-toolbars1",
|
|
46
|
+
"@liveblocks/core": "2.16.0-toolbars1",
|
|
47
|
+
"@liveblocks/react": "2.16.0-toolbars1",
|
|
48
|
+
"@liveblocks/react-ui": "2.16.0-toolbars1",
|
|
49
|
+
"@liveblocks/yjs": "2.16.0-toolbars1",
|
|
50
|
+
"@radix-ui/react-select": "^2.1.2",
|
|
51
|
+
"@radix-ui/react-toggle": "^1.1.0",
|
|
50
52
|
"@tiptap/core": "^2.7.2",
|
|
51
53
|
"@tiptap/react": "^2.7.2",
|
|
52
54
|
"@tiptap/suggestion": "^2.7.2",
|
|
55
|
+
"cmdk": "^1.0.4",
|
|
53
56
|
"y-prosemirror": "^1.2.12",
|
|
54
57
|
"yjs": "^13.6.18"
|
|
55
58
|
},
|
|
@@ -69,7 +72,7 @@
|
|
|
69
72
|
"@testing-library/jest-dom": "^5.16.5",
|
|
70
73
|
"eslint-plugin-react": "^7.33.2",
|
|
71
74
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
72
|
-
"msw": "^
|
|
75
|
+
"msw": "^1.3.5",
|
|
73
76
|
"rollup": "3.28.0",
|
|
74
77
|
"stylelint": "^15.10.2",
|
|
75
78
|
"stylelint-config-standard": "^34.0.0",
|
|
@@ -82,7 +85,7 @@
|
|
|
82
85
|
},
|
|
83
86
|
"repository": {
|
|
84
87
|
"type": "git",
|
|
85
|
-
"url": "https://github.com/liveblocks/liveblocks.git",
|
|
88
|
+
"url": "git+https://github.com/liveblocks/liveblocks.git",
|
|
86
89
|
"directory": "packages/liveblocks-react-tiptap"
|
|
87
90
|
},
|
|
88
91
|
"homepage": "https://liveblocks.io",
|
package/src/styles/constants.css
CHANGED
package/src/styles/index.css
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
*************************************/
|
|
38
38
|
|
|
39
39
|
.lb-tiptap-suggestions {
|
|
40
|
-
padding: $lb-elevation-
|
|
40
|
+
padding: $lb-elevation-padding;
|
|
41
41
|
animation-duration: var(--lb-transition-duration);
|
|
42
42
|
animation-timing-function: var(--lb-transition-easing);
|
|
43
43
|
will-change: transform, opacity;
|
|
@@ -47,23 +47,26 @@
|
|
|
47
47
|
display: flex;
|
|
48
48
|
align-items: center;
|
|
49
49
|
padding: calc(0.25 * var(--lb-spacing)) calc(0.5 * var(--lb-spacing));
|
|
50
|
-
border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-
|
|
50
|
+
border-radius: calc(var(--lb-radius) - 0.75 * $lb-elevation-padding);
|
|
51
51
|
color: var(--lb-foreground-secondary);
|
|
52
52
|
outline: none;
|
|
53
53
|
font-size: 0.875rem;
|
|
54
54
|
cursor: pointer;
|
|
55
55
|
user-select: none;
|
|
56
56
|
transition-property: background, color, opacity;
|
|
57
|
-
scroll-margin-block: $lb-elevation-
|
|
57
|
+
scroll-margin-block: $lb-elevation-padding;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
:is(.lb-tiptap-suggestions-list-item) {
|
|
61
|
-
&:where(
|
|
61
|
+
&:where(
|
|
62
|
+
[data-highlighted]:not([data-highlighted="false"]),
|
|
63
|
+
[data-selected]:not([data-selected="false"])
|
|
64
|
+
) {
|
|
62
65
|
background: var(--lb-foreground-subtle);
|
|
63
66
|
transition-duration: calc(var(--lb-transition-duration) / 2);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
&:where(:disabled, [data-disabled]) {
|
|
69
|
+
&:where(:disabled, [data-disabled]:not([data-disabled="false"])) {
|
|
67
70
|
opacity: 0.5;
|
|
68
71
|
cursor: not-allowed;
|
|
69
72
|
}
|
|
@@ -209,13 +212,62 @@
|
|
|
209
212
|
inline-size: var(--lb-tiptap-floating-size);
|
|
210
213
|
}
|
|
211
214
|
|
|
215
|
+
/*************************************
|
|
216
|
+
* Active selection *
|
|
217
|
+
*************************************/
|
|
218
|
+
|
|
212
219
|
.lb-tiptap-active-selection {
|
|
213
220
|
background: var(--lb-selection, rgb(0 0 255 / 20%));
|
|
214
221
|
pointer-events: none;
|
|
215
222
|
}
|
|
216
223
|
|
|
217
224
|
/*************************************
|
|
218
|
-
*
|
|
225
|
+
* Toolbar *
|
|
226
|
+
*************************************/
|
|
227
|
+
|
|
228
|
+
.lb-tiptap-toolbar {
|
|
229
|
+
--lb-tiptap-toolbar-spacing: calc(0.25 * var(--lb-spacing));
|
|
230
|
+
|
|
231
|
+
position: relative;
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: row;
|
|
234
|
+
gap: var(--lb-tiptap-toolbar-spacing);
|
|
235
|
+
align-items: center;
|
|
236
|
+
padding: var(--lb-tiptap-toolbar-spacing);
|
|
237
|
+
background: var(--lb-background);
|
|
238
|
+
|
|
239
|
+
/* overflow-inline: auto; doesn't work as expected */
|
|
240
|
+
/* stylelint-disable-next-line plugin/use-logical-properties-and-values */
|
|
241
|
+
overflow-x: auto;
|
|
242
|
+
|
|
243
|
+
@include invisible-scrollbar;
|
|
244
|
+
|
|
245
|
+
> * {
|
|
246
|
+
flex: none;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.lb-tiptap-floating-toolbar {
|
|
251
|
+
--lb-tiptap-toolbar-spacing: $lb-elevation-padding;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.lb-tiptap-toolbar-separator {
|
|
255
|
+
position: relative;
|
|
256
|
+
align-self: stretch;
|
|
257
|
+
inline-size: 1px;
|
|
258
|
+
margin-inline: 1px;
|
|
259
|
+
pointer-events: none;
|
|
260
|
+
|
|
261
|
+
&::before {
|
|
262
|
+
content: "";
|
|
263
|
+
position: absolute;
|
|
264
|
+
inset: 10% 0;
|
|
265
|
+
background: var(--lb-foreground-subtle);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/*************************************
|
|
270
|
+
* Collab Cursors *
|
|
219
271
|
*************************************/
|
|
220
272
|
|
|
221
273
|
/* Give a remote user a caret */
|