@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.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -3179,9 +3179,9 @@ function createImagePlugin(onImageUpload) {
|
|
|
3179
3179
|
alert('Please enter an image URL');
|
|
3180
3180
|
return;
|
|
3181
3181
|
}
|
|
3182
|
-
// Validate URL safety
|
|
3182
|
+
// Validate URL safety (allow data:image/* for base64-encoded uploads)
|
|
3183
3183
|
const srcWithoutMeta = src.split('|__aid__:')[0];
|
|
3184
|
-
if (!isUrlSafe(srcWithoutMeta)) {
|
|
3184
|
+
if (!isUrlSafe(srcWithoutMeta) && !srcWithoutMeta.startsWith('data:image/')) {
|
|
3185
3185
|
alert('Invalid image URL');
|
|
3186
3186
|
return;
|
|
3187
3187
|
}
|
|
@@ -3227,9 +3227,8 @@ function createImagePlugin(onImageUpload) {
|
|
|
3227
3227
|
if (e.target === e.currentTarget) {
|
|
3228
3228
|
setShowModal(false);
|
|
3229
3229
|
}
|
|
3230
|
-
}, children: jsxs("div", { className: "rte-image-modal", children: [jsxs("div", { className: "rte-image-modal-header", children: [jsx("h3", { children: "Insert Image" }), jsx("button", { type: "button", onClick: () => setShowModal(false), className: "rte-image-modal-close", "aria-label": "Close", children: jsx(IconWrapper, { icon: "mdi:close", width: 20, height: 20 }) })] }), jsxs("div", { className: "rte-image-modal-content", children: [onImageUpload && (jsx("div", { className: "rte-image-upload-section", children: jsxs("label", { className: "rte-image-upload-label", children: [jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, style: { display: 'none' } }), jsx("div", { className: "rte-image-upload-button", children: isUploading ? (jsxs(Fragment, { children: [jsx(IconWrapper, { icon: "mdi:loading", width: 24, height: 24, className: "rte-spin" }), jsx("span", { children: "Uploading..." })] })) : (jsxs(Fragment, { children: [jsx(IconWrapper, { icon: "mdi:upload", width: 24, height: 24 }), jsx("span", { children: "Choose File" })] })) })] }) })), jsx("div", { className: "rte-image-url-section", children: jsxs("label", { children: ["Image URL", jsx("input", { type: "
|
|
3230
|
+
}, children: jsxs("div", { className: "rte-image-modal", children: [jsxs("div", { className: "rte-image-modal-header", children: [jsx("h3", { children: "Insert Image" }), jsx("button", { type: "button", onClick: () => setShowModal(false), className: "rte-image-modal-close", "aria-label": "Close", children: jsx(IconWrapper, { icon: "mdi:close", width: 20, height: 20 }) })] }), jsxs("div", { className: "rte-image-modal-content", children: [onImageUpload && (jsx("div", { className: "rte-image-upload-section", children: jsxs("label", { className: "rte-image-upload-label", children: [jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileSelect, style: { display: 'none' } }), jsx("div", { className: "rte-image-upload-button", children: isUploading ? (jsxs(Fragment, { children: [jsx(IconWrapper, { icon: "mdi:loading", width: 24, height: 24, className: "rte-spin" }), jsx("span", { children: "Uploading..." })] })) : (jsxs(Fragment, { children: [jsx(IconWrapper, { icon: "mdi:upload", width: 24, height: 24 }), jsx("span", { children: "Choose File" })] })) })] }) })), jsx("div", { className: "rte-image-url-section", children: jsxs("label", { children: ["Image URL", jsx("input", { type: "text", value: imageUrl, onChange: (e) => {
|
|
3231
3231
|
setImageUrl(e.target.value);
|
|
3232
|
-
// Clear raw URL when user manually edits
|
|
3233
3232
|
setRawUrl('');
|
|
3234
3233
|
}, placeholder: "https://example.com/image.jpg", className: "rte-image-url-input" })] }) }), jsx("div", { className: "rte-image-alt-section", children: jsxs("label", { children: ["Alt Text (optional)", jsx("input", { type: "text", value: altText, onChange: (e) => setAltText(e.target.value), placeholder: "Image description", className: "rte-image-alt-input" })] }) }), imageUrl && (jsx("div", { className: "rte-image-preview", children: jsx("img", { src: imageUrl, alt: altText || 'Preview' }) }))] }), jsxs("div", { className: "rte-image-modal-footer", children: [jsx("button", { type: "button", onClick: () => setShowModal(false), className: "rte-image-modal-cancel", children: "Cancel" }), jsx("button", { type: "button", onClick: handleInsertImage, disabled: !imageUrl.trim() || isUploading, className: "rte-image-modal-insert", children: "Insert" })] })] }) }))] }));
|
|
3235
3234
|
},
|
|
@@ -4114,6 +4113,7 @@ const defaultEditorSettings = {
|
|
|
4114
4113
|
numberedList: true,
|
|
4115
4114
|
quote: true,
|
|
4116
4115
|
codeBlock: true,
|
|
4116
|
+
horizontalRule: true,
|
|
4117
4117
|
check: true,
|
|
4118
4118
|
typography: ["h1", "h2", "h3", "h4", "h5", "h6"],
|
|
4119
4119
|
colors: [
|
|
@@ -4192,6 +4192,9 @@ function buildPluginsFromSettings(settings = defaultEditorSettings, options = {}
|
|
|
4192
4192
|
plugins.push(subscriptPlugin);
|
|
4193
4193
|
if (fmt.superscript)
|
|
4194
4194
|
plugins.push(superscriptPlugin);
|
|
4195
|
+
// Horizontal rule
|
|
4196
|
+
if (fmt.horizontalRule)
|
|
4197
|
+
plugins.push(horizontalRulePlugin);
|
|
4195
4198
|
// Table
|
|
4196
4199
|
if (settings.table?.enabled) {
|
|
4197
4200
|
plugins.push(tablePlugin);
|