@juo/orion-extensions 0.10.1 → 0.10.2
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/extensions.js +56 -1
- package/package.json +2 -2
package/dist/extensions.js
CHANGED
|
@@ -7783,7 +7783,7 @@ function createVueCeRenderer(name, component, { shadowRoot = true } = {}) {
|
|
|
7783
7783
|
return createCeRenderer(name);
|
|
7784
7784
|
}
|
|
7785
7785
|
function isEditorMessage(message) {
|
|
7786
|
-
return message.type === "PROVIDE_THEME_STATE" || message.type === "PROVIDE_TRANSLATION_OVERRIDES" || message.type === "SELECT_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "ADD_BLOCK" || message.type === "REMOVE_BLOCK" || message.type === "MOVE_BLOCK" || message.type === "SET_BLOCK_PRESET" || message.type === "SET_LOCALE" || message.type === "SET_GLOBAL_STYLES" || message.type === "PROVIDE_GLOBAL_STYLES";
|
|
7786
|
+
return message.type === "PROVIDE_THEME_STATE" || message.type === "PROVIDE_TRANSLATION_OVERRIDES" || message.type === "SELECT_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "ADD_BLOCK" || message.type === "REMOVE_BLOCK" || message.type === "MOVE_BLOCK" || message.type === "SET_BLOCK_PRESET" || message.type === "SET_LOCALE" || message.type === "SET_GLOBAL_STYLES" || message.type === "PROVIDE_GLOBAL_STYLES" || message.type === "SCROLL_SYNC" || message.type === "REQUEST_CONTENT_HEIGHT";
|
|
7787
7787
|
}
|
|
7788
7788
|
function createRequestThemeStateMessage(payload) {
|
|
7789
7789
|
return {
|
|
@@ -7814,6 +7814,20 @@ function createRequestGlobalStylesMessage(payload) {
|
|
|
7814
7814
|
timestamp: Date.now()
|
|
7815
7815
|
};
|
|
7816
7816
|
}
|
|
7817
|
+
function createScrollSyncMessage(payload) {
|
|
7818
|
+
return {
|
|
7819
|
+
type: "SCROLL_SYNC",
|
|
7820
|
+
payload,
|
|
7821
|
+
timestamp: Date.now()
|
|
7822
|
+
};
|
|
7823
|
+
}
|
|
7824
|
+
function createReportContentHeightMessage(payload) {
|
|
7825
|
+
return {
|
|
7826
|
+
type: "REPORT_CONTENT_HEIGHT",
|
|
7827
|
+
payload,
|
|
7828
|
+
timestamp: Date.now()
|
|
7829
|
+
};
|
|
7830
|
+
}
|
|
7817
7831
|
let bridgeInstance = null;
|
|
7818
7832
|
function createEditorBridge() {
|
|
7819
7833
|
if (bridgeInstance !== null) {
|
|
@@ -7996,6 +8010,13 @@ function createEditorBridge() {
|
|
|
7996
8010
|
}
|
|
7997
8011
|
} else if (data.type === "SELECT_BLOCK") {
|
|
7998
8012
|
updateBlockSelection(data.payload.blockId);
|
|
8013
|
+
} else if (data.type === "SCROLL_SYNC") {
|
|
8014
|
+
suppressScrollReport = true;
|
|
8015
|
+
window.scrollTo(0, data.payload.scrollY);
|
|
8016
|
+
return;
|
|
8017
|
+
} else if (data.type === "REQUEST_CONTENT_HEIGHT") {
|
|
8018
|
+
reportContentHeight();
|
|
8019
|
+
return;
|
|
7999
8020
|
}
|
|
8000
8021
|
messageHandlers.forEach((handler) => handler(data));
|
|
8001
8022
|
}
|
|
@@ -8017,6 +8038,35 @@ function createEditorBridge() {
|
|
|
8017
8038
|
});
|
|
8018
8039
|
}
|
|
8019
8040
|
const isEditorMode = window.parent !== window;
|
|
8041
|
+
let ghostScrollStyleEl = null;
|
|
8042
|
+
let ghostScrollObserver = null;
|
|
8043
|
+
let suppressScrollReport = false;
|
|
8044
|
+
function reportContentHeight() {
|
|
8045
|
+
var _a;
|
|
8046
|
+
if (!isEditorMode)
|
|
8047
|
+
return;
|
|
8048
|
+
const height = Math.max(
|
|
8049
|
+
document.documentElement.scrollHeight,
|
|
8050
|
+
((_a = document.body) == null ? void 0 : _a.scrollHeight) ?? 0
|
|
8051
|
+
);
|
|
8052
|
+
sendMessage(createReportContentHeightMessage({ height }));
|
|
8053
|
+
}
|
|
8054
|
+
function handleScrollEvent() {
|
|
8055
|
+
if (suppressScrollReport) {
|
|
8056
|
+
suppressScrollReport = false;
|
|
8057
|
+
return;
|
|
8058
|
+
}
|
|
8059
|
+
sendMessage(createScrollSyncMessage({ scrollY: window.scrollY }));
|
|
8060
|
+
}
|
|
8061
|
+
if (isEditorMode) {
|
|
8062
|
+
ghostScrollStyleEl = document.createElement("style");
|
|
8063
|
+
ghostScrollStyleEl.textContent = "html { scrollbar-width: none; } html::-webkit-scrollbar { display: none; }";
|
|
8064
|
+
document.head.appendChild(ghostScrollStyleEl);
|
|
8065
|
+
window.addEventListener("scroll", handleScrollEvent, { passive: true });
|
|
8066
|
+
ghostScrollObserver = new ResizeObserver(reportContentHeight);
|
|
8067
|
+
ghostScrollObserver.observe(document.documentElement);
|
|
8068
|
+
reportContentHeight();
|
|
8069
|
+
}
|
|
8020
8070
|
function onBlockPresetChange(blockId, callback) {
|
|
8021
8071
|
return onMessage((message) => {
|
|
8022
8072
|
if (message.type !== "SET_BLOCK_PRESET")
|
|
@@ -8033,6 +8083,11 @@ function createEditorBridge() {
|
|
|
8033
8083
|
function destroy() {
|
|
8034
8084
|
window.removeEventListener("message", handleWindowMessage);
|
|
8035
8085
|
document.removeEventListener("click", handleGlobalClick, true);
|
|
8086
|
+
window.removeEventListener("scroll", handleScrollEvent);
|
|
8087
|
+
ghostScrollObserver == null ? void 0 : ghostScrollObserver.disconnect();
|
|
8088
|
+
ghostScrollObserver = null;
|
|
8089
|
+
ghostScrollStyleEl == null ? void 0 : ghostScrollStyleEl.remove();
|
|
8090
|
+
ghostScrollStyleEl = null;
|
|
8036
8091
|
for (const [, { timer }] of pendingRequests) {
|
|
8037
8092
|
clearTimeout(timer);
|
|
8038
8093
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juo/orion-extensions",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tailwindcss": "3.3.5",
|
|
45
45
|
"vue": "3.5.13",
|
|
46
46
|
"@juo/customer-ui": "0.2.0",
|
|
47
|
-
"@juo/orion-core": "0.
|
|
47
|
+
"@juo/orion-core": "0.15.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"dev": "vite build -w",
|