@dxos/react-ui-editor 0.4.6-main.20d1ec4 → 0.4.6-main.2c76dca
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.
|
@@ -3253,6 +3253,14 @@ var image = (options = {}) => {
|
|
|
3253
3253
|
provide: (field) => EditorView12.decorations.from(field)
|
|
3254
3254
|
});
|
|
3255
3255
|
};
|
|
3256
|
+
var preloaded = /* @__PURE__ */ new Set();
|
|
3257
|
+
var preloadImage = (url) => {
|
|
3258
|
+
if (!preloaded.has(url)) {
|
|
3259
|
+
const img = document.createElement("img");
|
|
3260
|
+
img.src = url;
|
|
3261
|
+
preloaded.add(url);
|
|
3262
|
+
}
|
|
3263
|
+
};
|
|
3256
3264
|
var buildDecorations2 = (from, to, state) => {
|
|
3257
3265
|
const decorations = [];
|
|
3258
3266
|
const cursor = state.selection.main.head;
|
|
@@ -3263,6 +3271,7 @@ var buildDecorations2 = (from, to, state) => {
|
|
|
3263
3271
|
if (urlNode) {
|
|
3264
3272
|
const hide2 = state.readOnly || cursor < node.from || cursor > node.to;
|
|
3265
3273
|
const url = state.sliceDoc(urlNode.from, urlNode.to);
|
|
3274
|
+
preloadImage(url);
|
|
3266
3275
|
decorations.push(Decoration5.replace({
|
|
3267
3276
|
block: true,
|
|
3268
3277
|
widget: new ImageWidget(url)
|