@duskmoon-dev/el-markdown-input 1.7.2 → 1.7.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/cjs/index.js +34 -5
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/register.js +32 -3
- package/dist/cjs/register.js.map +3 -3
- package/dist/esm/index.js +34 -5
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/register.js +32 -3
- package/dist/esm/register.js.map +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/element.d.ts +2 -0
- package/dist/types/element.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -105,8 +105,8 @@ var init_sanitize_schema = __esm(() => {
|
|
|
105
105
|
// src/render.ts
|
|
106
106
|
var exports_render = {};
|
|
107
107
|
__export(exports_render, {
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
renderMarkdown: () => renderMarkdown,
|
|
109
|
+
renderMermaidBlocks: () => renderMermaidBlocks
|
|
110
110
|
});
|
|
111
111
|
function renderFrontMatter() {
|
|
112
112
|
return (tree) => {
|
|
@@ -246,9 +246,9 @@ var init_render = __esm(() => {
|
|
|
246
246
|
// src/index.ts
|
|
247
247
|
var exports_src = {};
|
|
248
248
|
__export(exports_src, {
|
|
249
|
-
|
|
249
|
+
ElDmMarkdownInput: () => ElDmMarkdownInput,
|
|
250
250
|
MarkdownInputHook: () => MarkdownInputHook,
|
|
251
|
-
|
|
251
|
+
register: () => register
|
|
252
252
|
});
|
|
253
253
|
module.exports = __toCommonJS(exports_src);
|
|
254
254
|
|
|
@@ -1183,6 +1183,9 @@ class ElDmMarkdownInput extends import_el_base2.BaseElement {
|
|
|
1183
1183
|
resize: { type: String, reflect: true, default: "none" },
|
|
1184
1184
|
noPreview: { type: Boolean, reflect: true, attribute: "no-preview" }
|
|
1185
1185
|
};
|
|
1186
|
+
static get observedAttributes() {
|
|
1187
|
+
return [...super.observedAttributes, "id"];
|
|
1188
|
+
}
|
|
1186
1189
|
#internals;
|
|
1187
1190
|
#initialized = false;
|
|
1188
1191
|
#activeTab = "write";
|
|
@@ -1234,6 +1237,12 @@ class ElDmMarkdownInput extends import_el_base2.BaseElement {
|
|
|
1234
1237
|
clearTimeout(this.#livePreviewTimer);
|
|
1235
1238
|
super.disconnectedCallback();
|
|
1236
1239
|
}
|
|
1240
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
1241
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
1242
|
+
if (name === "id" && oldValue !== newValue && this.isConnected) {
|
|
1243
|
+
this.#syncEditorIdentity();
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1237
1246
|
update() {
|
|
1238
1247
|
if (!this.#initialized) {
|
|
1239
1248
|
super.update();
|
|
@@ -1258,6 +1267,7 @@ class ElDmMarkdownInput extends import_el_base2.BaseElement {
|
|
|
1258
1267
|
if (!ta)
|
|
1259
1268
|
return;
|
|
1260
1269
|
const placeholder = this.placeholder ?? "Write markdown…";
|
|
1270
|
+
this.#syncEditorIdentity();
|
|
1261
1271
|
ta.placeholder = placeholder;
|
|
1262
1272
|
ta.disabled = !!this.disabled;
|
|
1263
1273
|
ta.readOnly = !!this.readonly;
|
|
@@ -1297,7 +1307,24 @@ class ElDmMarkdownInput extends import_el_base2.BaseElement {
|
|
|
1297
1307
|
}
|
|
1298
1308
|
this.#updateStatusBarNow();
|
|
1299
1309
|
}
|
|
1310
|
+
#syncEditorIdentity() {
|
|
1311
|
+
const ta = this.#textarea;
|
|
1312
|
+
if (!ta)
|
|
1313
|
+
return;
|
|
1314
|
+
const editorId = this.id;
|
|
1315
|
+
const name = this.name || "";
|
|
1316
|
+
if (editorId)
|
|
1317
|
+
ta.id = editorId;
|
|
1318
|
+
else
|
|
1319
|
+
ta.removeAttribute("id");
|
|
1320
|
+
if (name)
|
|
1321
|
+
ta.name = name;
|
|
1322
|
+
else
|
|
1323
|
+
ta.removeAttribute("name");
|
|
1324
|
+
}
|
|
1300
1325
|
render() {
|
|
1326
|
+
const editorId = this.id;
|
|
1327
|
+
const name = this.name || "";
|
|
1301
1328
|
const ph = this.placeholder ?? "Write markdown…";
|
|
1302
1329
|
const disabled = !!this.disabled;
|
|
1303
1330
|
const readonly = !!this.readonly;
|
|
@@ -1328,6 +1355,8 @@ class ElDmMarkdownInput extends import_el_base2.BaseElement {
|
|
|
1328
1355
|
<div class="write-area" id="write-panel" role="tabpanel" aria-labelledby="tab-write">
|
|
1329
1356
|
<div class="render-layer" aria-hidden="true"></div>
|
|
1330
1357
|
<textarea
|
|
1358
|
+
${editorId ? `id="${escapeHtmlStr(editorId)}"` : ""}
|
|
1359
|
+
${name ? `name="${escapeHtmlStr(name)}"` : ""}
|
|
1331
1360
|
aria-label="Markdown editor"
|
|
1332
1361
|
aria-haspopup="listbox"
|
|
1333
1362
|
aria-expanded="false"
|
|
@@ -1998,5 +2027,5 @@ var MarkdownInputHook = {
|
|
|
1998
2027
|
}
|
|
1999
2028
|
};
|
|
2000
2029
|
|
|
2001
|
-
//# debugId=
|
|
2030
|
+
//# debugId=6E5EB6E59669FD5064756E2164756E21
|
|
2002
2031
|
//# sourceMappingURL=index.js.map
|