@remirror/extension-image
Advanced tools
Comparing version 2.1.8 to 2.1.9
@@ -43,2 +43,3 @@ var __defProp = Object.defineProperty; | ||
objectFit: "contain" | ||
// maintain image's aspect ratio | ||
}); | ||
@@ -58,3 +59,2 @@ return inner; | ||
createNodeSpec(extra, override) { | ||
var _a; | ||
const { preferPastedTextContent } = this.options; | ||
@@ -82,6 +82,6 @@ return { | ||
getAttrs: (element) => { | ||
var _a2; | ||
var _a; | ||
if (isElementDomNode(element)) { | ||
const attrs = getImageAttributes({ element, parse: extra.parse }); | ||
if (preferPastedTextContent && ((_a2 = attrs.src) == null ? void 0 : _a2.startsWith("file:///"))) { | ||
if (preferPastedTextContent && ((_a = attrs.src) == null ? void 0 : _a.startsWith("file:///"))) { | ||
return false; | ||
@@ -94,3 +94,3 @@ } | ||
}, | ||
...(_a = override.parseDOM) != null ? _a : [] | ||
...override.parseDOM ?? [] | ||
], | ||
@@ -105,3 +105,3 @@ toDOM: (node) => { | ||
return ({ tr, dispatch }) => { | ||
const { from, to } = getTextSelection(selection != null ? selection : tr.selection, tr.doc); | ||
const { from, to } = getTextSelection(selection ?? tr.selection, tr.doc); | ||
const node = this.type.create(attributes); | ||
@@ -237,12 +237,11 @@ dispatch == null ? void 0 : dispatch(tr.replaceRangeWith(from, to, node)); | ||
}) { | ||
var _a, _b, _c, _d; | ||
const { width, height } = getDimensions(element); | ||
return { | ||
...parse(element), | ||
alt: (_a = element.getAttribute("alt")) != null ? _a : "", | ||
alt: element.getAttribute("alt") ?? "", | ||
height: Number.parseInt(height || "0", 10) || null, | ||
src: (_b = element.getAttribute("src")) != null ? _b : null, | ||
title: (_c = element.getAttribute("title")) != null ? _c : "", | ||
src: element.getAttribute("src") ?? null, | ||
title: element.getAttribute("title") ?? "", | ||
width: Number.parseInt(width || "0", 10) || null, | ||
fileName: (_d = element.getAttribute("data-file-name")) != null ? _d : null | ||
fileName: element.getAttribute("data-file-name") ?? null | ||
}; | ||
@@ -263,12 +262,18 @@ } | ||
for (const { file, progress } of files) { | ||
promises.push(() => new Promise((resolve) => { | ||
const reader = new FileReader(); | ||
reader.addEventListener("load", (readerEvent) => { | ||
var _a; | ||
completed += 1; | ||
progress(completed / files.length); | ||
resolve({ src: (_a = readerEvent.target) == null ? void 0 : _a.result, fileName: file.name }); | ||
}, { once: true }); | ||
reader.readAsDataURL(file); | ||
})); | ||
promises.push( | ||
() => new Promise((resolve) => { | ||
const reader = new FileReader(); | ||
reader.addEventListener( | ||
"load", | ||
(readerEvent) => { | ||
var _a; | ||
completed += 1; | ||
progress(completed / files.length); | ||
resolve({ src: (_a = readerEvent.target) == null ? void 0 : _a.result, fileName: file.name }); | ||
}, | ||
{ once: true } | ||
); | ||
reader.readAsDataURL(file); | ||
}) | ||
); | ||
} | ||
@@ -285,2 +290,1 @@ return promises; | ||
}; | ||
//# sourceMappingURL=remirror-extension-image.js.map |
{ | ||
"name": "@remirror/extension-image", | ||
"version": "2.1.8", | ||
"version": "2.1.9", | ||
"description": "Add images to your editor.", | ||
@@ -27,5 +27,5 @@ "keywords": [ | ||
".": { | ||
"types": "./dist/remirror-extension-image.d.ts", | ||
"import": "./dist/remirror-extension-image.js", | ||
"require": "./dist/remirror-extension-image.cjs", | ||
"types": "./dist-types/index.d.ts" | ||
"require": "./dist/remirror-extension-image.cjs" | ||
}, | ||
@@ -36,3 +36,3 @@ "./package.json": "./package.json" | ||
"module": "./dist/remirror-extension-image.js", | ||
"types": "./dist-types/index.d.ts", | ||
"types": "./dist/remirror-extension-image.d.ts", | ||
"files": [ | ||
@@ -43,17 +43,14 @@ "dist", | ||
"dependencies": { | ||
"@babel/runtime": "^7.13.10", | ||
"@remirror/core": "^2.0.12", | ||
"@remirror/messages": "^2.0.2", | ||
"@remirror/theme": "^2.0.6", | ||
"prosemirror-resizable-view": "^2.0.11" | ||
"@babel/runtime": "^7.21.0", | ||
"@remirror/core": "^2.0.13", | ||
"@remirror/messages": "^2.0.3", | ||
"@remirror/theme": "^2.0.7", | ||
"prosemirror-resizable-view": "^2.0.12" | ||
}, | ||
"devDependencies": { | ||
"@remirror/pm": "^2.0.4" | ||
"@remirror/pm": "^2.0.5" | ||
}, | ||
"peerDependencies": { | ||
"@remirror/pm": "^2.0.4" | ||
"@remirror/pm": "^2.0.5" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"@remirror": { | ||
@@ -60,0 +57,0 @@ "sizeLimit": "20 KB" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1090
102208
11
Updated@babel/runtime@^7.21.0
Updated@remirror/core@^2.0.13
Updated@remirror/messages@^2.0.3
Updated@remirror/theme@^2.0.7