@alpaca-editor/core 1.0.3850 → 1.0.3851
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/config/config.js +0 -1
- package/dist/config/config.js.map +1 -1
- package/dist/editor/ContentTree.js +2 -22
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/client/EditorClient.js +5 -5
- package/dist/editor/client/EditorClient.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +0 -2
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/menubar/LanguageSelector.js +1 -1
- package/dist/editor/menubar/LanguageSelector.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/InlineEditor.js +2 -2
- package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +2 -2
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/page-viewer/pageModelBuilder.js +1 -1
- package/dist/editor/page-viewer/pageModelBuilder.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.js +1 -1
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/sidebar/MainContentTree.js +7 -4
- package/dist/editor/sidebar/MainContentTree.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/package.json +1 -1
- package/src/config/config.tsx +0 -1
- package/src/editor/ContentTree.tsx +3 -27
- package/src/editor/client/EditorClient.tsx +5 -5
- package/src/editor/commands/componentCommands.tsx +0 -2
- package/src/editor/menubar/LanguageSelector.tsx +1 -0
- package/src/editor/page-editor-chrome/FrameMenu.tsx +1 -4
- package/src/editor/page-editor-chrome/InlineEditor.tsx +2 -2
- package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +2 -2
- package/src/editor/page-viewer/PageViewerFrame.tsx +0 -1
- package/src/editor/page-viewer/pageModelBuilder.ts +1 -1
- package/src/editor/sidebar/ComponentTree.tsx +1 -1
- package/src/editor/sidebar/MainContentTree.tsx +18 -12
- package/src/revision.ts +2 -2
|
@@ -524,7 +524,7 @@ export function EditorClient({
|
|
|
524
524
|
|
|
525
525
|
useEffect(() => {
|
|
526
526
|
if (typeof window === "undefined") return;
|
|
527
|
-
|
|
527
|
+
const keepAliveUrl = "/alpaca/editor/keepalive";
|
|
528
528
|
const interval = setInterval(
|
|
529
529
|
() => {
|
|
530
530
|
fetch(keepAliveUrl + "?ts=" + Date.now()).catch((error) =>
|
|
@@ -698,7 +698,7 @@ export function EditorClient({
|
|
|
698
698
|
c.language === currentItemDescriptor.language &&
|
|
699
699
|
c.version === currentItemDescriptor.version,
|
|
700
700
|
);
|
|
701
|
-
|
|
701
|
+
const allComments = [...loadedComments, ...newComments];
|
|
702
702
|
allComments.sort((a, b) => a.position - b.position);
|
|
703
703
|
return allComments;
|
|
704
704
|
});
|
|
@@ -885,7 +885,7 @@ export function EditorClient({
|
|
|
885
885
|
|
|
886
886
|
const addToBrowseHistory = useCallback(
|
|
887
887
|
(item: FullItem) => {
|
|
888
|
-
|
|
888
|
+
const historyEntry = {
|
|
889
889
|
path: item.path || "unknown",
|
|
890
890
|
name: item.name || "unknown",
|
|
891
891
|
language: item.language,
|
|
@@ -1209,7 +1209,7 @@ export function EditorClient({
|
|
|
1209
1209
|
});
|
|
1210
1210
|
return;
|
|
1211
1211
|
}
|
|
1212
|
-
|
|
1212
|
+
const v = [...result.data.versions].reverse() || [];
|
|
1213
1213
|
|
|
1214
1214
|
setItemVersions(v);
|
|
1215
1215
|
setItemLanguages(result.data.languages);
|
|
@@ -1325,7 +1325,7 @@ export function EditorClient({
|
|
|
1325
1325
|
);
|
|
1326
1326
|
|
|
1327
1327
|
useEffect(() => {
|
|
1328
|
-
|
|
1328
|
+
const items: ItemDescriptor[] = [];
|
|
1329
1329
|
|
|
1330
1330
|
if (editContext.contentEditorItem) {
|
|
1331
1331
|
items.push(editContext.contentEditorItem.descriptor);
|
|
@@ -54,6 +54,7 @@ export function LanguageSelector({
|
|
|
54
54
|
? "text-gray-500 hover:bg-gray-300"
|
|
55
55
|
: "text-gray-200 hover:bg-gray-500"
|
|
56
56
|
} rounded-md ${disabled ? "opacity-50" : ""}`}
|
|
57
|
+
data-testid="language-selector"
|
|
57
58
|
onClick={(ev) => {
|
|
58
59
|
if (disabled) return;
|
|
59
60
|
overlaypanel.current?.toggle(ev, ev.currentTarget);
|
|
@@ -322,10 +322,7 @@ export function FrameMenu({
|
|
|
322
322
|
}}
|
|
323
323
|
>
|
|
324
324
|
{typeof b.icon === "string" ? (
|
|
325
|
-
<i
|
|
326
|
-
className={b.icon + " cursor-pointer text-sm"}
|
|
327
|
-
title={b.label}
|
|
328
|
-
/>
|
|
325
|
+
<i className={b.icon + " cursor-pointer text-sm"} />
|
|
329
326
|
) : (
|
|
330
327
|
b.icon
|
|
331
328
|
)}
|
|
@@ -73,7 +73,7 @@ export function InlineEditor({
|
|
|
73
73
|
value = isRichText ? clone.innerHTML : clone.innerText;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
const modifiedFieldValue = modifiedFieldsContext?.modifiedFields.find(
|
|
77
77
|
(x) =>
|
|
78
78
|
x.fieldId === fieldId &&
|
|
79
79
|
x.item.id === itemId &&
|
|
@@ -448,7 +448,7 @@ export function InlineEditor({
|
|
|
448
448
|
selection.removeAllRanges();
|
|
449
449
|
|
|
450
450
|
// Find the appropriate text node and offset
|
|
451
|
-
|
|
451
|
+
const currentNode = element.firstChild;
|
|
452
452
|
let currentPos = 0;
|
|
453
453
|
|
|
454
454
|
// Helper function to find the right node and position
|
|
@@ -275,10 +275,10 @@ function detectOrientation(
|
|
|
275
275
|
// Check for flex direction
|
|
276
276
|
if (display === "flex" || display === "inline-flex") {
|
|
277
277
|
const flexDirection = parentStyle.getPropertyValue("flex-direction");
|
|
278
|
-
if (flexDirection === "row" ||
|
|
278
|
+
if (flexDirection === "row" || "row-reverse") {
|
|
279
279
|
return "horizontal";
|
|
280
280
|
}
|
|
281
|
-
if (flexDirection === "column" ||
|
|
281
|
+
if (flexDirection === "column" || "column-reverse") {
|
|
282
282
|
return "vertical";
|
|
283
283
|
}
|
|
284
284
|
}
|
|
@@ -3,7 +3,6 @@ import { MiniMap } from "./MiniMap";
|
|
|
3
3
|
import {
|
|
4
4
|
useEditContext,
|
|
5
5
|
useEditContextRef,
|
|
6
|
-
EditorMode,
|
|
7
6
|
} from "../client/editContext";
|
|
8
7
|
import { useDebouncedCallback, useThrottledCallback } from "use-debounce";
|
|
9
8
|
import { PageEditorChrome } from "../page-editor-chrome/PageEditorChrome";
|
|
@@ -362,7 +362,7 @@ export function buildPageModel(
|
|
|
362
362
|
placeholderStartId.indexOf(currentComponent.id + "_") === 0
|
|
363
363
|
? placeholderStartId.substring(currentComponent.id.length + 1)
|
|
364
364
|
: placeholderStartId,
|
|
365
|
-
description: "",
|
|
365
|
+
description: element.getAttribute("data-description") || "",
|
|
366
366
|
components: [],
|
|
367
367
|
parentComponent: currentComponent,
|
|
368
368
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
2
|
import { InsertOption } from "../../types";
|
|
3
3
|
import ContentTree from "../ContentTree";
|
|
4
4
|
import { useEditContext } from "../client/editContext";
|
|
@@ -21,6 +21,22 @@ export function MainContentTree({
|
|
|
21
21
|
const selectedItem = editContext.contentEditorItem ?? page?.item;
|
|
22
22
|
const [selectedItemIds, setSelectedItemIds] = useState<string[]>([]);
|
|
23
23
|
|
|
24
|
+
const isDraggable = useCallback(
|
|
25
|
+
(x: ItemTreeNodeData) => {
|
|
26
|
+
return (
|
|
27
|
+
mode === "insert" &&
|
|
28
|
+
insertOptions?.find(
|
|
29
|
+
(insertOption: InsertOption) =>
|
|
30
|
+
insertOption.typeId == x.templateId ||
|
|
31
|
+
insertOption.compatibleTypeIds?.find(
|
|
32
|
+
(compatibleTemplate) => compatibleTemplate == x.templateId,
|
|
33
|
+
) !== undefined,
|
|
34
|
+
) !== undefined
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
[mode, insertOptions],
|
|
38
|
+
);
|
|
39
|
+
|
|
24
40
|
useEffect(() => {
|
|
25
41
|
if (selectedItem) setSelectedItemIds([selectedItem.id]);
|
|
26
42
|
}, [selectedItem]);
|
|
@@ -33,7 +49,6 @@ export function MainContentTree({
|
|
|
33
49
|
};
|
|
34
50
|
loadInsertOptions();
|
|
35
51
|
}, [editContext.selection, page]);
|
|
36
|
-
|
|
37
52
|
return (
|
|
38
53
|
<div className="flex h-full flex-col">
|
|
39
54
|
<div className="border-b border-gray-200 p-2">
|
|
@@ -73,16 +88,7 @@ export function MainContentTree({
|
|
|
73
88
|
version: selectedItems[0].version,
|
|
74
89
|
});
|
|
75
90
|
}}
|
|
76
|
-
isDraggable={
|
|
77
|
-
mode === "insert" &&
|
|
78
|
-
insertOptions?.find(
|
|
79
|
-
(insertOption: InsertOption) =>
|
|
80
|
-
insertOption.typeId == x.templateId ||
|
|
81
|
-
insertOption.compatibleTypeIds?.find(
|
|
82
|
-
(compatibleTemplate) => compatibleTemplate == x.templateId,
|
|
83
|
-
) !== undefined,
|
|
84
|
-
) !== undefined
|
|
85
|
-
}
|
|
91
|
+
isDraggable={isDraggable}
|
|
86
92
|
renderNode={(node, defaultRenderer) => (
|
|
87
93
|
<div className="group flex w-full gap-4">
|
|
88
94
|
{defaultRenderer(node)}
|
package/src/revision.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
2
|
-
export const buildDate = "2025-04-28
|
|
1
|
+
export const version = "1.0.3851";
|
|
2
|
+
export const buildDate = "2025-04-28 18:28:02";
|