@overlap/rte 1.0.0 → 1.0.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/dist/index.d.ts +1 -0
- package/dist/index.esm.js +7 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/plugins/image.d.ts.map +1 -1
- package/dist/styles.css +16 -14
- package/dist/utils/settings.d.ts +1 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -3183,9 +3183,9 @@ function createImagePlugin(onImageUpload) {
|
|
|
3183
3183
|
alert('Please enter an image URL');
|
|
3184
3184
|
return;
|
|
3185
3185
|
}
|
|
3186
|
-
// Validate URL safety
|
|
3186
|
+
// Validate URL safety (allow data:image/* for base64-encoded uploads)
|
|
3187
3187
|
const srcWithoutMeta = src.split('|__aid__:')[0];
|
|
3188
|
-
if (!isUrlSafe(srcWithoutMeta)) {
|
|
3188
|
+
if (!isUrlSafe(srcWithoutMeta) && !srcWithoutMeta.startsWith('data:image/')) {
|
|
3189
3189
|
alert('Invalid image URL');
|
|
3190
3190
|
return;
|
|
3191
3191
|
}
|
|
@@ -3231,9 +3231,8 @@ function createImagePlugin(onImageUpload) {
|
|
|
3231
3231
|
if (e.target === e.currentTarget) {
|
|
3232
3232
|
setShowModal(false);
|
|
3233
3233
|
}
|
|
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: "
|
|
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: "text", value: imageUrl, onChange: (e) => {
|
|
3235
3235
|
setImageUrl(e.target.value);
|
|
3236
|
-
// Clear raw URL when user manually edits
|
|
3237
3236
|
setRawUrl('');
|
|
3238
3237
|
}, 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
3238
|
},
|
|
@@ -4118,6 +4117,7 @@ const defaultEditorSettings = {
|
|
|
4118
4117
|
numberedList: true,
|
|
4119
4118
|
quote: true,
|
|
4120
4119
|
codeBlock: true,
|
|
4120
|
+
horizontalRule: true,
|
|
4121
4121
|
check: true,
|
|
4122
4122
|
typography: ["h1", "h2", "h3", "h4", "h5", "h6"],
|
|
4123
4123
|
colors: [
|
|
@@ -4196,6 +4196,9 @@ function buildPluginsFromSettings(settings = defaultEditorSettings, options = {}
|
|
|
4196
4196
|
plugins.push(subscriptPlugin);
|
|
4197
4197
|
if (fmt.superscript)
|
|
4198
4198
|
plugins.push(superscriptPlugin);
|
|
4199
|
+
// Horizontal rule
|
|
4200
|
+
if (fmt.horizontalRule)
|
|
4201
|
+
plugins.push(horizontalRulePlugin);
|
|
4199
4202
|
// Table
|
|
4200
4203
|
if (settings.table?.enabled) {
|
|
4201
4204
|
plugins.push(tablePlugin);
|