@aeriz/wysiwyg 1.0.1 → 1.0.2
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 +1 -1
- package/dist/aeriz-wysiwyg.esm.js +24 -4
- package/dist/aeriz-wysiwyg.esm.min.js +273 -258
- package/dist/aeriz-wysiwyg.js +24 -4
- package/dist/aeriz-wysiwyg.min.js +11 -11
- package/dist-types/core/blocks.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@0.0.1/dist/aeriz-wysiwyg.min.js"></script>
|
|
22
22
|
|
|
23
23
|
<!-- 1.x 트랙 — 패치만 자동 수신 -->
|
|
24
|
-
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@^1.0.
|
|
24
|
+
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@^1.0.2/dist/aeriz-wysiwyg.min.js"></script>
|
|
25
25
|
|
|
26
26
|
<!-- 항상 최신 — 프로토타이핑용 (프로덕션 권장 X) -->
|
|
27
27
|
<script src="https://cdn.jsdelivr.net/npm/@aeriz/wysiwyg@latest/dist/aeriz-wysiwyg.min.js"></script>
|
|
@@ -3859,12 +3859,32 @@ function applyBlockInlineStyles(root, theme = {}) {
|
|
|
3859
3859
|
function mergeInlineStyle(el, portable) {
|
|
3860
3860
|
const existing = (el.getAttribute("style") ?? "").trim();
|
|
3861
3861
|
if (!existing) {
|
|
3862
|
-
|
|
3862
|
+
const trimmed = portable.replace(/;\s*$/, "").trim();
|
|
3863
|
+
if (trimmed) el.setAttribute("style", trimmed);
|
|
3863
3864
|
return;
|
|
3864
3865
|
}
|
|
3865
|
-
const
|
|
3866
|
-
const
|
|
3867
|
-
|
|
3866
|
+
const userDecls = parseStyleDeclarations(existing);
|
|
3867
|
+
const userProps = new Set(userDecls.map((d) => d.prop));
|
|
3868
|
+
const portableDecls = parseStyleDeclarations(portable).filter(
|
|
3869
|
+
(d) => !userProps.has(d.prop)
|
|
3870
|
+
);
|
|
3871
|
+
const merged = [...portableDecls, ...userDecls].map((d) => `${d.prop}:${d.value}`).join(";");
|
|
3872
|
+
if (merged) el.setAttribute("style", merged);
|
|
3873
|
+
else el.removeAttribute("style");
|
|
3874
|
+
}
|
|
3875
|
+
function parseStyleDeclarations(s) {
|
|
3876
|
+
const out = [];
|
|
3877
|
+
for (const part of s.split(";")) {
|
|
3878
|
+
const trimmed = part.trim();
|
|
3879
|
+
if (!trimmed) continue;
|
|
3880
|
+
const idx = trimmed.indexOf(":");
|
|
3881
|
+
if (idx <= 0) continue;
|
|
3882
|
+
const prop = trimmed.slice(0, idx).trim().toLowerCase();
|
|
3883
|
+
const value = trimmed.slice(idx + 1).trim();
|
|
3884
|
+
if (!prop || !value) continue;
|
|
3885
|
+
out.push({ prop, value });
|
|
3886
|
+
}
|
|
3887
|
+
return out;
|
|
3868
3888
|
}
|
|
3869
3889
|
function stripEditorOnlyAttrs(root) {
|
|
3870
3890
|
for (const el of Array.from(root.querySelectorAll("[data-block-kind]"))) {
|