@overlap/rte 1.0.2 → 1.0.4
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/index.esm.js +16 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +16 -14
- package/dist/utils/checkbox.d.ts.map +1 -1
- package/dist/utils/listIndent.d.ts.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -272,6 +272,12 @@ function ensureAllCheckboxes(editor) {
|
|
|
272
272
|
if (!ul.classList.contains("rte-checkbox-list")) {
|
|
273
273
|
ul.classList.add("rte-checkbox-list");
|
|
274
274
|
}
|
|
275
|
+
// Propagate checkbox class to nested ULs inside LI children
|
|
276
|
+
ul.querySelectorAll(":scope > li > ul").forEach((nestedUl) => {
|
|
277
|
+
if (!nestedUl.classList.contains("rte-checkbox-list")) {
|
|
278
|
+
nestedUl.classList.add("rte-checkbox-list");
|
|
279
|
+
}
|
|
280
|
+
});
|
|
275
281
|
// Handle GitHub format: convert <input type="checkbox"> to aria-checked
|
|
276
282
|
ul.querySelectorAll(":scope > li").forEach((li) => {
|
|
277
283
|
const input = li.querySelector('input[type="checkbox"]');
|
|
@@ -1426,8 +1432,10 @@ function indentListItem(selection) {
|
|
|
1426
1432
|
// Create nested list in the previous item
|
|
1427
1433
|
let nestedList = previousItem.querySelector('ul, ol');
|
|
1428
1434
|
if (!nestedList) {
|
|
1429
|
-
// Create new nested list
|
|
1430
1435
|
nestedList = document.createElement(list.tagName.toLowerCase());
|
|
1436
|
+
if (list.classList.contains('rte-checkbox-list')) {
|
|
1437
|
+
nestedList.classList.add('rte-checkbox-list');
|
|
1438
|
+
}
|
|
1431
1439
|
previousItem.appendChild(nestedList);
|
|
1432
1440
|
}
|
|
1433
1441
|
// Move current item into nested list
|
|
@@ -1455,6 +1463,9 @@ function indentListItem(selection) {
|
|
|
1455
1463
|
else {
|
|
1456
1464
|
// No previous item — create new nested list in current item
|
|
1457
1465
|
const nestedList = document.createElement(list.tagName.toLowerCase());
|
|
1466
|
+
if (list.classList.contains('rte-checkbox-list')) {
|
|
1467
|
+
nestedList.classList.add('rte-checkbox-list');
|
|
1468
|
+
}
|
|
1458
1469
|
// Move all following items into the nested list
|
|
1459
1470
|
let nextSibling = listItem.nextElementSibling;
|
|
1460
1471
|
while (nextSibling && nextSibling.tagName === 'LI') {
|
|
@@ -3183,9 +3194,9 @@ function createImagePlugin(onImageUpload) {
|
|
|
3183
3194
|
alert('Please enter an image URL');
|
|
3184
3195
|
return;
|
|
3185
3196
|
}
|
|
3186
|
-
// Validate URL safety
|
|
3197
|
+
// Validate URL safety (allow data:image/* for base64-encoded uploads)
|
|
3187
3198
|
const srcWithoutMeta = src.split('|__aid__:')[0];
|
|
3188
|
-
if (!isUrlSafe(srcWithoutMeta)) {
|
|
3199
|
+
if (!isUrlSafe(srcWithoutMeta) && !srcWithoutMeta.startsWith('data:image/')) {
|
|
3189
3200
|
alert('Invalid image URL');
|
|
3190
3201
|
return;
|
|
3191
3202
|
}
|
|
@@ -3227,13 +3238,12 @@ function createImagePlugin(onImageUpload) {
|
|
|
3227
3238
|
}
|
|
3228
3239
|
}
|
|
3229
3240
|
};
|
|
3230
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { type: "button", onClick: () => setShowModal(true), disabled: props.disabled, className: "rte-toolbar-button", title: "Insert Image", "aria-label": "Insert Image", children: jsxRuntime.jsx(IconWrapper, { icon: "mdi:image", width: 18, height: 18 }) }), showModal && (jsxRuntime.jsx("div", { className: "rte-image-modal-overlay", onClick: (e) => {
|
|
3241
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { type: "button", onClick: () => setShowModal(true), disabled: props.disabled, className: "rte-toolbar-button", title: "Insert Image", "aria-label": "Insert Image", children: jsxRuntime.jsx(IconWrapper, { icon: "mdi:image", width: 18, height: 18 }) }), showModal && (jsxRuntime.jsx("div", { className: "rte-image-modal-overlay", onMouseDown: (e) => e.stopPropagation(), onClick: (e) => {
|
|
3231
3242
|
if (e.target === e.currentTarget) {
|
|
3232
3243
|
setShowModal(false);
|
|
3233
3244
|
}
|
|
3234
|
-
}, children: jsxRuntime.jsxs("div", { className: "rte-image-modal", children: [jsxRuntime.jsxs("div", { className: "rte-image-modal-header", children: [jsxRuntime.jsx("h3", { children: "Insert Image" }), jsxRuntime.jsx("button", { type: "button", onClick: () => setShowModal(false), className: "rte-image-modal-close", "aria-label": "Close", children: jsxRuntime.jsx(IconWrapper, { icon: "mdi:close", width: 20, height: 20 }) })] }), jsxRuntime.jsxs("div", { className: "rte-image-modal-content", children: [onImageUpload && (jsxRuntime.jsx("div", { className: "rte-image-upload-section", children: jsxRuntime.jsxs("label", { className: "rte-image-upload-label", children: [jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, style: { display: 'none' } }), jsxRuntime.jsx("div", { className: "rte-image-upload-button", children: isUploading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconWrapper, { icon: "mdi:loading", width: 24, height: 24, className: "rte-spin" }), jsxRuntime.jsx("span", { children: "Uploading..." })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconWrapper, { icon: "mdi:upload", width: 24, height: 24 }), jsxRuntime.jsx("span", { children: "Choose File" })] })) })] }) })), jsxRuntime.jsx("div", { className: "rte-image-url-section", children: jsxRuntime.jsxs("label", { children: ["Image URL", jsxRuntime.jsx("input", { type: "
|
|
3245
|
+
}, children: jsxRuntime.jsxs("div", { className: "rte-image-modal", children: [jsxRuntime.jsxs("div", { className: "rte-image-modal-header", children: [jsxRuntime.jsx("h3", { children: "Insert Image" }), jsxRuntime.jsx("button", { type: "button", onClick: () => setShowModal(false), className: "rte-image-modal-close", "aria-label": "Close", children: jsxRuntime.jsx(IconWrapper, { icon: "mdi:close", width: 20, height: 20 }) })] }), jsxRuntime.jsxs("div", { className: "rte-image-modal-content", children: [onImageUpload && (jsxRuntime.jsx("div", { className: "rte-image-upload-section", children: jsxRuntime.jsxs("label", { className: "rte-image-upload-label", children: [jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, style: { display: 'none' } }), jsxRuntime.jsx("div", { className: "rte-image-upload-button", children: isUploading ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconWrapper, { icon: "mdi:loading", width: 24, height: 24, className: "rte-spin" }), jsxRuntime.jsx("span", { children: "Uploading..." })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconWrapper, { icon: "mdi:upload", width: 24, height: 24 }), jsxRuntime.jsx("span", { children: "Choose File" })] })) })] }) })), jsxRuntime.jsx("div", { className: "rte-image-url-section", children: jsxRuntime.jsxs("label", { children: ["Image URL", jsxRuntime.jsx("input", { type: "text", value: imageUrl, onChange: (e) => {
|
|
3235
3246
|
setImageUrl(e.target.value);
|
|
3236
|
-
// Clear raw URL when user manually edits
|
|
3237
3247
|
setRawUrl('');
|
|
3238
3248
|
}, placeholder: "https://example.com/image.jpg", className: "rte-image-url-input" })] }) }), jsxRuntime.jsx("div", { className: "rte-image-alt-section", children: jsxRuntime.jsxs("label", { children: ["Alt Text (optional)", jsxRuntime.jsx("input", { type: "text", value: altText, onChange: (e) => setAltText(e.target.value), placeholder: "Image description", className: "rte-image-alt-input" })] }) }), imageUrl && (jsxRuntime.jsx("div", { className: "rte-image-preview", children: jsxRuntime.jsx("img", { src: imageUrl, alt: altText || 'Preview' }) }))] }), jsxRuntime.jsxs("div", { className: "rte-image-modal-footer", children: [jsxRuntime.jsx("button", { type: "button", onClick: () => setShowModal(false), className: "rte-image-modal-cancel", children: "Cancel" }), jsxRuntime.jsx("button", { type: "button", onClick: handleInsertImage, disabled: !imageUrl.trim() || isUploading, className: "rte-image-modal-insert", children: "Insert" })] })] }) }))] }));
|
|
3239
3249
|
},
|