camox 0.42.0 → 0.44.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/bin/camox.mjs +9 -1
- package/dist/core/components/lexical/{GradientNode.js → HighlightNode.js} +34 -34
- package/dist/core/components/lexical/InlineLexicalEditor.js +14 -14
- package/dist/core/components/lexical/InlineStylesPlugin.js +25 -9
- package/dist/core/components/lexical/SelectionBroadcaster.js +7 -7
- package/dist/core/components/lexical/SidebarLexicalEditor.js +24 -24
- package/dist/core/components/lexical/TextLinkPopover.js +191 -208
- package/dist/core/components/lexical/editorConfig.js +2 -2
- package/dist/core/createApp.d.ts +31 -4
- package/dist/core/createApp.js +2 -1
- package/dist/core/createBlock.js +24 -10
- package/dist/core/createLayout.d.ts +16 -3
- package/dist/core/createLayout.js +15 -15
- package/dist/core/derivedRoutes.js +1 -1
- package/dist/core/dom.d.ts +17 -0
- package/dist/core/dom.js +22 -0
- package/dist/core/editing/createEditableBlock.d.ts +135 -1
- package/dist/core/editing/createEditableBlock.js +209 -74
- package/dist/core/lib/contentType.d.ts +5 -0
- package/dist/core/lib/contentType.js +11 -0
- package/dist/core/lib/fieldTypes.js +1 -0
- package/dist/core/lib/iconTypes.d.ts +13 -0
- package/dist/core/lib/icons.d.ts +6 -0
- package/dist/core/lib/icons.js +130 -0
- package/dist/core/lib/lexicalReact.js +4 -4
- package/dist/core/lib/lexicalState.js +8 -8
- package/dist/core/lib/modifierFormats.js +2 -2
- package/dist/core/lib/textLinks.js +5 -2
- package/dist/core/lib/textStyles.d.ts +3 -3
- package/dist/core/lib/textStyles.js +9 -14
- package/dist/core/pageDestinations.js +37 -0
- package/dist/features/content/components/AssetCard.js +104 -68
- package/dist/features/og/imageResponse.node.js +11 -9
- package/dist/features/preview/CamoxPreview.js +148 -146
- package/dist/features/preview/commentsEnabled.js +2 -2
- package/dist/features/preview/components/AddBlockSidebar.js +1 -1
- package/dist/features/preview/components/AssetLightbox.js +17 -6
- package/dist/features/preview/components/AttachedComments.js +224 -87
- package/dist/features/preview/components/BlockActionsPopover.js +1 -1
- package/dist/features/preview/components/CommentTargetQuote.js +22 -21
- package/dist/features/preview/components/CreatePageModal.js +4 -4
- package/dist/features/preview/components/DerivedLayoutDialog.js +36 -21
- package/dist/features/preview/components/DerivedLayoutSidebar.js +45 -26
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +38 -26
- package/dist/features/preview/components/FieldOverlayStyles.js +29 -9
- package/dist/features/preview/components/FieldToolbar.js +12 -12
- package/dist/features/preview/components/IconFieldEditor.js +231 -0
- package/dist/features/preview/components/ItemFieldsEditor.js +21 -14
- package/dist/features/preview/components/LinkFieldEditor.js +212 -209
- package/dist/features/preview/components/OverlayTracker.js +1 -1
- package/dist/features/preview/components/PageEditorSidebar.js +1 -1
- package/dist/features/preview/components/PageInfoSidebar.js +28 -28
- package/dist/features/preview/components/PagePicker.js +46 -46
- package/dist/features/preview/components/PageTree.js +1 -1
- package/dist/features/preview/components/PreviewPanel.js +1 -1
- package/dist/features/preview/components/PreviewToolbar.js +224 -225
- package/dist/features/preview/components/PublicationRow.js +8 -4
- package/dist/features/preview/components/SendFeedbackDialog.js +83 -0
- package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
- package/dist/features/preview/overlayHighlights.js +54 -0
- package/dist/features/preview/previewCommentsStore.js +54 -34
- package/dist/features/preview/previewSelection.js +28 -23
- package/dist/features/preview/publication.js +10 -0
- package/dist/features/preview/usePageComments.js +39 -0
- package/dist/features/provider/CoreCamoxProvider.js +38 -6
- package/dist/features/provider/LocalhostPreviewProvider.js +81 -45
- package/dist/features/provider/components/CommandPalette.js +35 -84
- package/dist/features/runtime/pageApp.js +32 -28
- package/dist/features/runtime/pageServer.js +4 -1
- package/dist/features/runtime/runtime.d.ts +2 -0
- package/dist/features/runtime/runtime.js +45 -21
- package/dist/features/studio/components/EnvironmentMenu.js +76 -63
- package/dist/features/studio/components/Navbar.js +53 -80
- package/dist/features/vite/auth.js +1 -50
- package/dist/features/vite/iconGeneration.js +16 -0
- package/dist/features/vite/layoutGeneration.js +7 -3
- package/dist/features/vite/vite.d.ts +4 -2
- package/dist/features/vite/vite.js +24 -3
- package/dist/hooks/use-page-destinations.js +53 -0
- package/dist/lib/auth.js +40 -20
- package/dist/lib/preview-handoff.js +13 -0
- package/dist/lib/queries.js +12 -1
- package/dist/lib/server-auth-cookie.js +21 -0
- package/dist/lib/use-project-room.js +5 -2
- package/dist/studio-overlays.css +19 -15
- package/dist/studio.css +1 -1
- package/package.json +9 -4
- package/skills/camox/SKILL.md +38 -9
- package/skills/camox/references/block-definitions.md +107 -286
- package/skills/camox/references/cli-common.md +16 -4
- package/skills/camox/references/cli-content.md +158 -0
- package/skills/camox/references/cli-environments.md +1 -1
- package/skills/camox/references/dom-integrations.md +93 -0
- package/skills/camox/references/field-styling.md +50 -0
- package/skills/camox/references/layout-definitions.md +33 -147
- package/skills/camox/references/routed-layouts.md +71 -0
- package/skills/camoxify/SKILL.md +66 -0
- package/skills/camox/references/cli-blocks.md +0 -78
- package/skills/camox/references/cli-pages.md +0 -53
package/bin/camox.mjs
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
if (process.argv[2] === "typegen") {
|
|
3
|
+
// Resolve config without starting a server or requiring a logged-in build.
|
|
4
|
+
const { resolveConfig } = await import("vite-plus");
|
|
5
|
+
await resolveConfig({}, "serve");
|
|
6
|
+
// Config plugins can leave watchers alive even without a dev server.
|
|
7
|
+
process.exit(0);
|
|
8
|
+
} else {
|
|
9
|
+
await import("@camox/cli");
|
|
10
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { $applyNodeReplacement, $copyNode, $getSelection, $isElementNode, $isRangeSelection, $isTextNode, ElementNode } from "lexical";
|
|
2
2
|
|
|
3
|
-
//#region src/core/components/lexical/
|
|
4
|
-
var
|
|
3
|
+
//#region src/core/components/lexical/HighlightNode.ts
|
|
4
|
+
var HighlightNode = class HighlightNode extends ElementNode {
|
|
5
5
|
static getType() {
|
|
6
|
-
return "
|
|
6
|
+
return "highlight";
|
|
7
7
|
}
|
|
8
8
|
static clone(node) {
|
|
9
|
-
return new
|
|
9
|
+
return new HighlightNode(node.__key);
|
|
10
10
|
}
|
|
11
11
|
static importJSON(value) {
|
|
12
|
-
return $
|
|
12
|
+
return $createHighlightNode().updateFromJSON(value);
|
|
13
13
|
}
|
|
14
14
|
static importDOM() {
|
|
15
|
-
return { span: (element) => element.hasAttribute("data-camox-
|
|
16
|
-
conversion: () => ({ node: $
|
|
15
|
+
return { span: (element) => element.hasAttribute("data-camox-highlight") ? {
|
|
16
|
+
conversion: () => ({ node: $createHighlightNode() }),
|
|
17
17
|
priority: 1
|
|
18
18
|
} : null };
|
|
19
19
|
}
|
|
20
20
|
createDOM() {
|
|
21
21
|
const span = document.createElement("span");
|
|
22
|
-
span.dataset.
|
|
22
|
+
span.dataset.camoxHighlight = "";
|
|
23
23
|
return span;
|
|
24
24
|
}
|
|
25
25
|
updateDOM() {
|
|
@@ -38,30 +38,30 @@ var GradientNode = class GradientNode extends ElementNode {
|
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
function $
|
|
42
|
-
return $applyNodeReplacement(new
|
|
41
|
+
function $createHighlightNode() {
|
|
42
|
+
return $applyNodeReplacement(new HighlightNode());
|
|
43
43
|
}
|
|
44
|
-
function $
|
|
44
|
+
function $getHighlight(node) {
|
|
45
45
|
let current = node;
|
|
46
46
|
while (current) {
|
|
47
|
-
if (current instanceof
|
|
47
|
+
if (current instanceof HighlightNode) return current;
|
|
48
48
|
current = current.getParent();
|
|
49
49
|
}
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
-
function $
|
|
52
|
+
function $selectionHasHighlight() {
|
|
53
53
|
const selection = $getSelection();
|
|
54
54
|
if (!$isRangeSelection(selection)) return false;
|
|
55
|
-
if (selection.isCollapsed()) return !!$
|
|
55
|
+
if (selection.isCollapsed()) return !!$getHighlight(selection.anchor.getNode());
|
|
56
56
|
const texts = selection.getNodes().filter($isTextNode);
|
|
57
|
-
return texts.length > 0 && texts.every((node) => !!$
|
|
57
|
+
return texts.length > 0 && texts.every((node) => !!$getHighlight(node));
|
|
58
58
|
}
|
|
59
|
-
/** Isolate a selected leaf without removing
|
|
60
|
-
function $
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
59
|
+
/** Isolate a selected leaf without removing highlight from its unselected siblings. */
|
|
60
|
+
function $removeHighlightFrom(node) {
|
|
61
|
+
const highlight = $getHighlight(node);
|
|
62
|
+
if (!highlight) return;
|
|
63
63
|
let branch = node;
|
|
64
|
-
while (branch.getKey() !==
|
|
64
|
+
while (branch.getKey() !== highlight.getKey()) {
|
|
65
65
|
const parent = branch.getParentOrThrow();
|
|
66
66
|
const before = branch.getPreviousSiblings();
|
|
67
67
|
const after = branch.getNextSiblings();
|
|
@@ -77,40 +77,40 @@ function $removeGradientFrom(node) {
|
|
|
77
77
|
}
|
|
78
78
|
branch = parent;
|
|
79
79
|
}
|
|
80
|
-
for (const child of
|
|
81
|
-
|
|
80
|
+
for (const child of highlight.getChildren()) highlight.insertBefore(child);
|
|
81
|
+
highlight.remove();
|
|
82
82
|
}
|
|
83
|
-
function $
|
|
83
|
+
function $toggleHighlight() {
|
|
84
84
|
const selection = $getSelection();
|
|
85
85
|
if (!$isRangeSelection(selection) || selection.isCollapsed()) return;
|
|
86
|
-
const remove = $
|
|
86
|
+
const remove = $selectionHasHighlight();
|
|
87
87
|
const nodes = selection.extract().filter((node) => $isTextNode(node) || node.getType() === "linebreak");
|
|
88
88
|
for (const node of nodes) {
|
|
89
89
|
if (remove) {
|
|
90
|
-
$
|
|
90
|
+
$removeHighlightFrom(node);
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
|
-
if ($
|
|
93
|
+
if ($getHighlight(node)) continue;
|
|
94
94
|
const previous = node.getPreviousSibling();
|
|
95
|
-
if (previous instanceof
|
|
95
|
+
if (previous instanceof HighlightNode) {
|
|
96
96
|
previous.append(node);
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
node.insertBefore(
|
|
101
|
-
|
|
99
|
+
const highlight = $createHighlightNode();
|
|
100
|
+
node.insertBefore(highlight);
|
|
101
|
+
highlight.append(node);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
/** Keep one background across adjacent runs, including after formatting changes. */
|
|
105
|
-
function $
|
|
105
|
+
function $normalizeHighlight(node) {
|
|
106
106
|
const parent = node.getParent();
|
|
107
|
-
if (parent instanceof
|
|
107
|
+
if (parent instanceof HighlightNode) {
|
|
108
108
|
for (const child of node.getChildren()) node.insertBefore(child);
|
|
109
109
|
node.remove();
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
const next = node.getNextSibling();
|
|
113
|
-
if (next instanceof
|
|
113
|
+
if (next instanceof HighlightNode) {
|
|
114
114
|
node.append(...next.getChildren());
|
|
115
115
|
next.remove();
|
|
116
116
|
}
|
|
@@ -123,4 +123,4 @@ function $normalizeGradient(node) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
//#endregion
|
|
126
|
-
export { $
|
|
126
|
+
export { $normalizeHighlight, $selectionHasHighlight, $toggleHighlight, HighlightNode };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isValidTextLinkTarget } from "../../lib/textLinks.js";
|
|
2
2
|
import { lexicalStateToMarkdown } from "../../lib/lexicalState.js";
|
|
3
3
|
import { useFrame } from "../../../features/preview/components/Frame.js";
|
|
4
4
|
import { createEditorConfig, normalizeLexicalState } from "./editorConfig.js";
|
|
@@ -20,9 +20,9 @@ import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, INSERT_LINE_BRE
|
|
|
20
20
|
//#region src/core/components/lexical/InlineLexicalEditor.tsx
|
|
21
21
|
function ExternalStateSync(t0) {
|
|
22
22
|
const $ = c(8);
|
|
23
|
-
if ($[0] !== "
|
|
23
|
+
if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
|
|
24
24
|
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
25
|
-
$[0] = "
|
|
25
|
+
$[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
|
|
26
26
|
}
|
|
27
27
|
const { externalState } = t0;
|
|
28
28
|
const [editor] = useLexicalComposerContext();
|
|
@@ -79,9 +79,9 @@ function ExternalStateSync(t0) {
|
|
|
79
79
|
}
|
|
80
80
|
function EscapeHandler() {
|
|
81
81
|
const $ = c(4);
|
|
82
|
-
if ($[0] !== "
|
|
82
|
+
if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
|
|
83
83
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
84
|
-
$[0] = "
|
|
84
|
+
$[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
|
|
85
85
|
}
|
|
86
86
|
const [editor] = useLexicalComposerContext();
|
|
87
87
|
let t0;
|
|
@@ -104,9 +104,9 @@ function EscapeHandler() {
|
|
|
104
104
|
}
|
|
105
105
|
function EnterAsLineBreakHandler() {
|
|
106
106
|
const $ = c(4);
|
|
107
|
-
if ($[0] !== "
|
|
107
|
+
if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
|
|
108
108
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
109
|
-
$[0] = "
|
|
109
|
+
$[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
|
|
110
110
|
}
|
|
111
111
|
const [editor] = useLexicalComposerContext();
|
|
112
112
|
let t0;
|
|
@@ -130,9 +130,9 @@ function EnterAsLineBreakHandler() {
|
|
|
130
130
|
}
|
|
131
131
|
function PasteUrlAsLinkHandler() {
|
|
132
132
|
const $ = c(4);
|
|
133
|
-
if ($[0] !== "
|
|
133
|
+
if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
|
|
134
134
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
135
|
-
$[0] = "
|
|
135
|
+
$[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
|
|
136
136
|
}
|
|
137
137
|
const [editor] = useLexicalComposerContext();
|
|
138
138
|
let t0;
|
|
@@ -143,7 +143,7 @@ function PasteUrlAsLinkHandler() {
|
|
|
143
143
|
if (!$isRangeSelection(selection) || selection.isCollapsed()) return false;
|
|
144
144
|
if (!("clipboardData" in event) || !event.clipboardData) return false;
|
|
145
145
|
const url = event.clipboardData.getData("text/plain").trim();
|
|
146
|
-
if (!url || !
|
|
146
|
+
if (!url || !isValidTextLinkTarget(url)) return false;
|
|
147
147
|
event.preventDefault();
|
|
148
148
|
editor.dispatchCommand(TOGGLE_LINK_COMMAND, url);
|
|
149
149
|
return true;
|
|
@@ -161,9 +161,9 @@ function PasteUrlAsLinkHandler() {
|
|
|
161
161
|
}
|
|
162
162
|
function FocusBlurHandler(t0) {
|
|
163
163
|
const $ = c(6);
|
|
164
|
-
if ($[0] !== "
|
|
164
|
+
if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
|
|
165
165
|
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
166
|
-
$[0] = "
|
|
166
|
+
$[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
|
|
167
167
|
}
|
|
168
168
|
const { onFocus, onBlur } = t0;
|
|
169
169
|
const [editor] = useLexicalComposerContext();
|
|
@@ -265,9 +265,9 @@ function InlineLexicalEditor({ initialState, externalState, onChange, onFocus, o
|
|
|
265
265
|
}
|
|
266
266
|
function LexicalErrorBoundary(t0) {
|
|
267
267
|
const $ = c(3);
|
|
268
|
-
if ($[0] !== "
|
|
268
|
+
if ($[0] !== "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc") {
|
|
269
269
|
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
270
|
-
$[0] = "
|
|
270
|
+
$[0] = "ce0aab2d8f6174c436b3fa78439a44b23b8d509cc6b49c38f4129c459abdf4cc";
|
|
271
271
|
}
|
|
272
272
|
const { children } = t0;
|
|
273
273
|
let t1;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getPageIdFromTextLinkTarget, isHttpTextLinkTarget, resolveTextLinkHref, shouldOpenTextLinkInNewTab } from "../../lib/textLinks.js";
|
|
2
|
-
import {
|
|
3
|
-
import { $
|
|
2
|
+
import { getHighlightStyle, getTextAppearance } from "../../lib/textStyles.js";
|
|
3
|
+
import { $normalizeHighlight, HighlightNode } from "./HighlightNode.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { $isLinkNode } from "@lexical/link";
|
|
7
7
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
8
|
-
import { $getRoot, $isElementNode, $isTextNode } from "lexical";
|
|
8
|
+
import { $getRoot, $isElementNode, $isTextNode, COMMAND_PRIORITY_HIGH, FORMAT_TEXT_COMMAND } from "lexical";
|
|
9
9
|
|
|
10
10
|
//#region src/core/components/lexical/InlineStylesPlugin.tsx
|
|
11
11
|
const unitless = new Set([
|
|
@@ -56,10 +56,10 @@ const unitless = new Set([
|
|
|
56
56
|
]);
|
|
57
57
|
/** Only manages appearance attributes; Lexical retains ownership of the editable tree. */
|
|
58
58
|
function InlineStylesPlugin(options) {
|
|
59
|
-
const $ = c(
|
|
60
|
-
if ($[0] !== "
|
|
61
|
-
for (let $i = 0; $i <
|
|
62
|
-
$[0] = "
|
|
59
|
+
const $ = c(16);
|
|
60
|
+
if ($[0] !== "7983cd8e80c29064912c9ecb3122cfe24938f015007fbd8eb9dd8847d212676d") {
|
|
61
|
+
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
62
|
+
$[0] = "7983cd8e80c29064912c9ecb3122cfe24938f015007fbd8eb9dd8847d212676d";
|
|
63
63
|
}
|
|
64
64
|
const [editor] = useLexicalComposerContext();
|
|
65
65
|
let t0;
|
|
@@ -91,7 +91,7 @@ function InlineStylesPlugin(options) {
|
|
|
91
91
|
function visit(node) {
|
|
92
92
|
const dom_0 = editor.getElementByKey(node.getKey());
|
|
93
93
|
if (dom_0 && $isTextNode(node)) apply(dom_0, getTextAppearance(node.getFormat(), options));
|
|
94
|
-
if (dom_0 && node instanceof
|
|
94
|
+
if (dom_0 && node instanceof HighlightNode) apply(dom_0, getHighlightStyle(options));
|
|
95
95
|
if (dom_0 && $isLinkNode(node)) {
|
|
96
96
|
const target = node.getURL();
|
|
97
97
|
const href = resolveTextLinkHref(target, options.pages, options.fallbackHref ?? "#") ?? "#";
|
|
@@ -160,7 +160,7 @@ function InlineStylesPlugin(options) {
|
|
|
160
160
|
let t2;
|
|
161
161
|
let t3;
|
|
162
162
|
if ($[10] !== editor) {
|
|
163
|
-
t2 = () => editor.
|
|
163
|
+
t2 = () => editor.registerCommand(FORMAT_TEXT_COMMAND, _temp3, COMMAND_PRIORITY_HIGH);
|
|
164
164
|
t3 = [editor];
|
|
165
165
|
$[10] = editor;
|
|
166
166
|
$[11] = t2;
|
|
@@ -170,8 +170,24 @@ function InlineStylesPlugin(options) {
|
|
|
170
170
|
t3 = $[12];
|
|
171
171
|
}
|
|
172
172
|
React.useEffect(t2, t3);
|
|
173
|
+
let t4;
|
|
174
|
+
let t5;
|
|
175
|
+
if ($[13] !== editor) {
|
|
176
|
+
t4 = () => editor.registerNodeTransform(HighlightNode, $normalizeHighlight);
|
|
177
|
+
t5 = [editor];
|
|
178
|
+
$[13] = editor;
|
|
179
|
+
$[14] = t4;
|
|
180
|
+
$[15] = t5;
|
|
181
|
+
} else {
|
|
182
|
+
t4 = $[14];
|
|
183
|
+
t5 = $[15];
|
|
184
|
+
}
|
|
185
|
+
React.useEffect(t4, t5);
|
|
173
186
|
return null;
|
|
174
187
|
}
|
|
188
|
+
function _temp3(format) {
|
|
189
|
+
return format === "underline";
|
|
190
|
+
}
|
|
175
191
|
function _temp2(_, _prefix, letter_0) {
|
|
176
192
|
return letter_0.toLowerCase();
|
|
177
193
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FORMAT_FLAGS } from "../../lib/modifierFormats.js";
|
|
2
2
|
import { isOverlayMessage, postOverlayMessage } from "../../../features/preview/overlayMessages.js";
|
|
3
|
-
import { $
|
|
3
|
+
import { $selectionHasHighlight, $toggleHighlight } from "./HighlightNode.js";
|
|
4
4
|
import { selectTextLink } from "./selectTextLink.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
6
|
import * as React from "react";
|
|
@@ -24,9 +24,9 @@ function getLinkTargetFromSelection() {
|
|
|
24
24
|
}
|
|
25
25
|
function SelectionBroadcaster(t0) {
|
|
26
26
|
const $ = c(20);
|
|
27
|
-
if ($[0] !== "
|
|
27
|
+
if ($[0] !== "2d98eff236d853b0e4620c2d3c00e2ca29a164ad2d12c316c48e5344bd1ca447") {
|
|
28
28
|
for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
29
|
-
$[0] = "
|
|
29
|
+
$[0] = "2d98eff236d853b0e4620c2d3c00e2ca29a164ad2d12c316c48e5344bd1ca447";
|
|
30
30
|
}
|
|
31
31
|
const { targetWindow } = t0;
|
|
32
32
|
const [editor] = useLexicalComposerContext();
|
|
@@ -54,9 +54,9 @@ function SelectionBroadcaster(t0) {
|
|
|
54
54
|
for (const key of [
|
|
55
55
|
"bold",
|
|
56
56
|
"italic",
|
|
57
|
-
"
|
|
57
|
+
"strikethrough"
|
|
58
58
|
]) if (selection.hasFormat(key)) format = format | FORMAT_FLAGS[key];
|
|
59
|
-
if ($
|
|
59
|
+
if ($selectionHasHighlight()) format = format | FORMAT_FLAGS.highlight;
|
|
60
60
|
linkTarget = getLinkTargetFromSelection();
|
|
61
61
|
});
|
|
62
62
|
postOverlayMessage({
|
|
@@ -154,8 +154,8 @@ function SelectionBroadcaster(t0) {
|
|
|
154
154
|
if (lastTextSelectionRef.current) $setSelection(lastTextSelectionRef.current.clone());
|
|
155
155
|
});
|
|
156
156
|
if (data.type === "CAMOX_FORMAT_TEXT") {
|
|
157
|
-
if (data.formatKey === "
|
|
158
|
-
else if (data.formatKey === "bold" || data.formatKey === "italic" || data.formatKey === "
|
|
157
|
+
if (data.formatKey === "highlight") editor.update($toggleHighlight);
|
|
158
|
+
else if (data.formatKey === "bold" || data.formatKey === "italic" || data.formatKey === "strikethrough") editor.dispatchCommand(FORMAT_TEXT_COMMAND, data.formatKey);
|
|
159
159
|
} else if (data.target === null) editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
160
160
|
else if (typeof data.text === "string") {
|
|
161
161
|
const target_0 = data.target;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FORMAT_FLAGS } from "../../lib/modifierFormats.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isValidTextLinkTarget } from "../../lib/textLinks.js";
|
|
3
3
|
import { lexicalStateToMarkdown } from "../../lib/lexicalState.js";
|
|
4
4
|
import { INPUT_BASE_STYLES, INPUT_FOCUS_STYLES, cn } from "../../../lib/utils.js";
|
|
5
5
|
import { TextLinkPopover } from "./TextLinkPopover.js";
|
|
6
|
-
import { $
|
|
6
|
+
import { $selectionHasHighlight, $toggleHighlight } from "./HighlightNode.js";
|
|
7
7
|
import { createEditorConfig, normalizeLexicalState } from "./editorConfig.js";
|
|
8
8
|
import { InlineStylesPlugin } from "./InlineStylesPlugin.js";
|
|
9
9
|
import { selectTextLink } from "./selectTextLink.js";
|
|
@@ -11,7 +11,7 @@ import { c } from "react/compiler-runtime";
|
|
|
11
11
|
import * as React from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Button } from "@camox/ui/button";
|
|
14
|
-
import {
|
|
14
|
+
import { Bold, Highlighter, Italic, Strikethrough } from "lucide-react";
|
|
15
15
|
import { FloatingToolbar } from "@camox/ui/floating-toolbar";
|
|
16
16
|
import { Toggle } from "@camox/ui/toggle";
|
|
17
17
|
import { $createLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
@@ -27,9 +27,9 @@ import { $createTextNode, $getSelection, $isRangeSelection, $setSelection, COMMA
|
|
|
27
27
|
//#region src/core/components/lexical/SidebarLexicalEditor.tsx
|
|
28
28
|
function EnterAsLineBreakHandler() {
|
|
29
29
|
const $ = c(4);
|
|
30
|
-
if ($[0] !== "
|
|
30
|
+
if ($[0] !== "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a") {
|
|
31
31
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
32
|
-
$[0] = "
|
|
32
|
+
$[0] = "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a";
|
|
33
33
|
}
|
|
34
34
|
const [editor] = useLexicalComposerContext();
|
|
35
35
|
let t0;
|
|
@@ -53,9 +53,9 @@ function EnterAsLineBreakHandler() {
|
|
|
53
53
|
}
|
|
54
54
|
function ExternalStateSync(t0) {
|
|
55
55
|
const $ = c(6);
|
|
56
|
-
if ($[0] !== "
|
|
56
|
+
if ($[0] !== "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a") {
|
|
57
57
|
for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
58
|
-
$[0] = "
|
|
58
|
+
$[0] = "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a";
|
|
59
59
|
}
|
|
60
60
|
const { value, isSyncingRef } = t0;
|
|
61
61
|
const [editor] = useLexicalComposerContext();
|
|
@@ -91,9 +91,9 @@ function ExternalStateSync(t0) {
|
|
|
91
91
|
}
|
|
92
92
|
function SidebarFloatingTextToolbar() {
|
|
93
93
|
const $ = c(72);
|
|
94
|
-
if ($[0] !== "
|
|
94
|
+
if ($[0] !== "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a") {
|
|
95
95
|
for (let $i = 0; $i < 72; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
96
|
-
$[0] = "
|
|
96
|
+
$[0] = "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a";
|
|
97
97
|
}
|
|
98
98
|
const [editor] = useLexicalComposerContext();
|
|
99
99
|
const [open, setOpen] = React.useState(false);
|
|
@@ -143,8 +143,8 @@ function SidebarFloatingTextToolbar() {
|
|
|
143
143
|
setSelectedText(selection.getTextContent());
|
|
144
144
|
if (selection.hasFormat("bold")) activeFormats = activeFormats | FORMAT_FLAGS.bold;
|
|
145
145
|
if (selection.hasFormat("italic")) activeFormats = activeFormats | FORMAT_FLAGS.italic;
|
|
146
|
-
if (selection.hasFormat("
|
|
147
|
-
if ($
|
|
146
|
+
if (selection.hasFormat("strikethrough")) activeFormats = activeFormats | FORMAT_FLAGS.strikethrough;
|
|
147
|
+
if ($selectionHasHighlight()) activeFormats = activeFormats | FORMAT_FLAGS.highlight;
|
|
148
148
|
let node = selection.anchor.getNode();
|
|
149
149
|
while (node) {
|
|
150
150
|
if (node.getType?.() === "link") {
|
|
@@ -260,8 +260,8 @@ function SidebarFloatingTextToolbar() {
|
|
|
260
260
|
t9 = (formatKey) => {
|
|
261
261
|
editor.update(() => {
|
|
262
262
|
restoreSelection();
|
|
263
|
-
if (formatKey === "
|
|
264
|
-
$
|
|
263
|
+
if (formatKey === "highlight") {
|
|
264
|
+
$toggleHighlight();
|
|
265
265
|
return;
|
|
266
266
|
}
|
|
267
267
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, formatKey);
|
|
@@ -427,13 +427,13 @@ function SidebarFloatingTextToolbar() {
|
|
|
427
427
|
let t23;
|
|
428
428
|
if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
|
|
429
429
|
t23 = [{
|
|
430
|
-
key: "
|
|
431
|
-
label: "
|
|
432
|
-
icon:
|
|
430
|
+
key: "strikethrough",
|
|
431
|
+
label: "Strikethrough",
|
|
432
|
+
icon: Strikethrough
|
|
433
433
|
}, {
|
|
434
|
-
key: "
|
|
435
|
-
label: "
|
|
436
|
-
icon:
|
|
434
|
+
key: "highlight",
|
|
435
|
+
label: "Highlight",
|
|
436
|
+
icon: Highlighter
|
|
437
437
|
}];
|
|
438
438
|
$[53] = t23;
|
|
439
439
|
} else t23 = $[53];
|
|
@@ -518,9 +518,9 @@ function _temp(event_0) {
|
|
|
518
518
|
}
|
|
519
519
|
function PasteUrlAsLinkHandler() {
|
|
520
520
|
const $ = c(4);
|
|
521
|
-
if ($[0] !== "
|
|
521
|
+
if ($[0] !== "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a") {
|
|
522
522
|
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
523
|
-
$[0] = "
|
|
523
|
+
$[0] = "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a";
|
|
524
524
|
}
|
|
525
525
|
const [editor] = useLexicalComposerContext();
|
|
526
526
|
let t0;
|
|
@@ -531,7 +531,7 @@ function PasteUrlAsLinkHandler() {
|
|
|
531
531
|
if (!$isRangeSelection(selection) || selection.isCollapsed()) return false;
|
|
532
532
|
if (!("clipboardData" in event) || !event.clipboardData) return false;
|
|
533
533
|
const url = event.clipboardData.getData("text/plain").trim();
|
|
534
|
-
if (!
|
|
534
|
+
if (!isValidTextLinkTarget(url)) return false;
|
|
535
535
|
event.preventDefault();
|
|
536
536
|
editor.dispatchCommand(TOGGLE_LINK_COMMAND, url);
|
|
537
537
|
return true;
|
|
@@ -608,9 +608,9 @@ function SidebarLexicalEditor({ id, value, onChange, onFocus, onBlur }) {
|
|
|
608
608
|
}
|
|
609
609
|
function LexicalErrorBoundary(t0) {
|
|
610
610
|
const $ = c(3);
|
|
611
|
-
if ($[0] !== "
|
|
611
|
+
if ($[0] !== "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a") {
|
|
612
612
|
for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
613
|
-
$[0] = "
|
|
613
|
+
$[0] = "4aee3a6623d02d6d998f1ec56485427c5d00a9d232e9241d092ceba43ae1506a";
|
|
614
614
|
}
|
|
615
615
|
const { children } = t0;
|
|
616
616
|
let t1;
|