autumnnote 1.8.1 → 1.8.3
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/README.md +13 -7
- package/dist/autumnnote.css +0 -6
- package/dist/autumnnote.es.js +12 -3
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +12 -11
- package/dist/autumnnote.umd.js.map +1 -1
- package/dist/robots.txt +4 -0
- package/dist/sitemap.xml +18 -0
- package/package.json +8 -3
- package/src/js/index.js +1 -1
- package/src/js/module/Clipboard.js +3 -1
- package/src/js/module/ContextMenu.js +1 -1
- package/src/js/module/ImageCropOverlay.js +1 -0
- package/src/js/module/Mention.js +1 -0
- package/src/js/settings.js +7 -1
- package/src/styles/autumnnote.scss +1 -4
- package/types/index.d.ts +4 -2
package/dist/autumnnote.umd.js
CHANGED
|
@@ -1437,6 +1437,8 @@
|
|
|
1437
1437
|
autoSaveRestoreTimeout: 7,
|
|
1438
1438
|
onAutoSaveRestore: null,
|
|
1439
1439
|
markdownShortcuts: true,
|
|
1440
|
+
maxPasteSize: 5 * 1024 * 1024,
|
|
1441
|
+
minImageSize: 20,
|
|
1440
1442
|
bubbleToolbar: false,
|
|
1441
1443
|
bubbleToolbarItems: [
|
|
1442
1444
|
"bold",
|
|
@@ -7140,7 +7142,7 @@
|
|
|
7140
7142
|
_compressImage(file) {
|
|
7141
7143
|
const MAX_DIM = 1920;
|
|
7142
7144
|
const QUALITY = .85;
|
|
7143
|
-
return new Promise((resolve) => {
|
|
7145
|
+
return new Promise((resolve, reject) => {
|
|
7144
7146
|
const objectUrl = URL.createObjectURL(file);
|
|
7145
7147
|
const img = new Image();
|
|
7146
7148
|
img.onload = () => {
|
|
@@ -7160,6 +7162,7 @@
|
|
|
7160
7162
|
if (!ctx) {
|
|
7161
7163
|
const reader = new FileReader();
|
|
7162
7164
|
reader.onload = (e) => resolve(e.target.result);
|
|
7165
|
+
reader.onerror = () => reject(/* @__PURE__ */ new Error("FileReader failed"));
|
|
7163
7166
|
reader.readAsDataURL(file);
|
|
7164
7167
|
return;
|
|
7165
7168
|
}
|
|
@@ -7171,6 +7174,7 @@
|
|
|
7171
7174
|
URL.revokeObjectURL(objectUrl);
|
|
7172
7175
|
const reader = new FileReader();
|
|
7173
7176
|
reader.onload = (e) => resolve(e.target.result);
|
|
7177
|
+
reader.onerror = () => reject(/* @__PURE__ */ new Error("FileReader failed"));
|
|
7174
7178
|
reader.readAsDataURL(file);
|
|
7175
7179
|
};
|
|
7176
7180
|
img.src = objectUrl;
|
|
@@ -13892,7 +13896,7 @@
|
|
|
13892
13896
|
};
|
|
13893
13897
|
if (typeof navigator.clipboard.read === "function") navigator.clipboard.read().then((items) => {
|
|
13894
13898
|
for (const item of items) if (item.types.includes("text/html")) {
|
|
13895
|
-
item.getType("text/html").then((blob) => blob.text()).then((html) => doInsert(html, null));
|
|
13899
|
+
item.getType("text/html").then((blob) => blob.text()).then((html) => doInsert(html, null)).catch(() => {});
|
|
13896
13900
|
return;
|
|
13897
13901
|
}
|
|
13898
13902
|
navigator.clipboard.readText().then((text) => doInsert(null, text)).catch(() => {});
|
|
@@ -15017,6 +15021,10 @@
|
|
|
15017
15021
|
canvas.width = Math.round(renderW);
|
|
15018
15022
|
canvas.height = Math.round(renderH);
|
|
15019
15023
|
const ctx = canvas.getContext("2d");
|
|
15024
|
+
if (!ctx) {
|
|
15025
|
+
resolve(null);
|
|
15026
|
+
return;
|
|
15027
|
+
}
|
|
15020
15028
|
try {
|
|
15021
15029
|
ctx.drawImage(source, naturalRect.x, naturalRect.y, naturalRect.width, naturalRect.height, 0, 0, canvas.width, canvas.height);
|
|
15022
15030
|
ctx.getImageData(0, 0, 1, 1);
|
|
@@ -16276,6 +16284,7 @@
|
|
|
16276
16284
|
debounce: cfg.debounce ?? 200,
|
|
16277
16285
|
onSearch: cfg.onSearch,
|
|
16278
16286
|
onInsert: cfg.onInsert || null,
|
|
16287
|
+
onError: cfg.onError || null,
|
|
16279
16288
|
mentionClass: cfg.mentionClass || "an-mention",
|
|
16280
16289
|
allowSpaces: cfg.allowSpaces || false
|
|
16281
16290
|
};
|
|
@@ -16962,14 +16971,6 @@
|
|
|
16962
16971
|
}
|
|
16963
16972
|
};
|
|
16964
16973
|
//#endregion
|
|
16965
|
-
//#region src/js/core/env.js
|
|
16966
|
-
/**
|
|
16967
|
-
* env.js - Environment / browser detection
|
|
16968
|
-
* Inspired by Summernote's env.js
|
|
16969
|
-
*/
|
|
16970
|
-
var userAgent = navigator.userAgent;
|
|
16971
|
-
/Chrome\//.test(userAgent), /Firefox\//.test(userAgent), /^((?!chrome|android).)*safari/i.test(userAgent), /Edg\//.test(userAgent), /Macintosh/.test(userAgent), /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent), "ontouchstart" in globalThis || navigator.maxTouchPoints, /Macintosh/.test(userAgent);
|
|
16972
|
-
//#endregion
|
|
16973
16974
|
//#region src/js/index.js
|
|
16974
16975
|
var _originalDefaults = { ...defaultOptions };
|
|
16975
16976
|
/** @type {WeakMap<Element, Context>} */
|
|
@@ -17078,7 +17079,7 @@
|
|
|
17078
17079
|
/** All pre-built button definitions — accessible in every module format including UMD/CJS. */
|
|
17079
17080
|
buttons,
|
|
17080
17081
|
/** Library version */
|
|
17081
|
-
version: "1.8.
|
|
17082
|
+
version: "1.8.3"
|
|
17082
17083
|
};
|
|
17083
17084
|
/**
|
|
17084
17085
|
* @param {string|Element|NodeList|Element[]} selector
|