autumnnote 1.4.0 → 1.4.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 +2 -2
- package/dist/autumnnote.es.js +15 -8
- package/dist/autumnnote.es.js.map +1 -1
- package/dist/autumnnote.umd.js +15 -8
- package/dist/autumnnote.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/js/core/markdown.js +5 -5
- package/src/js/editing/Style.js +9 -7
- package/src/js/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autumnnote",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"description": "A modern
|
|
3
|
+
"version": "1.4.2",
|
|
4
|
+
"description": "Fast. Lightweight. Reliable. Efficient. A modern WYSIWYG editor built with vanilla JavaScript, no jQuery required.",
|
|
5
5
|
"main": "dist/autumnnote.umd.js",
|
|
6
6
|
"module": "dist/autumnnote.es.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
package/src/js/core/markdown.js
CHANGED
|
@@ -280,16 +280,16 @@ function _inline(text) {
|
|
|
280
280
|
text = text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, label, href) =>
|
|
281
281
|
`<a href="${_escAttr(href)}">${_esc(label)}</a>`);
|
|
282
282
|
// Bold + italic ***text***
|
|
283
|
-
text = text.replace(/\*{3}(
|
|
284
|
-
text = text.replace(/_{3}(
|
|
283
|
+
text = text.replace(/\*{3}([^*\n]+?)\*{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
|
|
284
|
+
text = text.replace(/_{3}([^_\n]+?)_{3}/g, (_, c) => `<strong><em>${_esc(c)}</em></strong>`);
|
|
285
285
|
// Bold **text**
|
|
286
|
-
text = text.replace(/\*{2}(
|
|
287
|
-
text = text.replace(/_{2}(
|
|
286
|
+
text = text.replace(/\*{2}([^*\n]+?)\*{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
|
|
287
|
+
text = text.replace(/_{2}([^_\n]+?)_{2}/g, (_, c) => `<strong>${_esc(c)}</strong>`);
|
|
288
288
|
// Italic *text* _text_
|
|
289
289
|
text = text.replace(/\*([^*\n]+?)\*/g, (_, c) => `<em>${_esc(c)}</em>`);
|
|
290
290
|
text = text.replace(/_([^_\n]+?)_/g, (_, c) => `<em>${_esc(c)}</em>`);
|
|
291
291
|
// Strikethrough ~~text~~
|
|
292
|
-
text = text.replace(/~~(
|
|
292
|
+
text = text.replace(/~~([^\n]+?)~~/g, (_, c) => `<del>${_esc(c)}</del>`);
|
|
293
293
|
// Inline code `code`
|
|
294
294
|
text = text.replace(/`([^`]+)`/g, (_, c) => `<code>${_esc(c)}</code>`);
|
|
295
295
|
return text;
|
package/src/js/editing/Style.js
CHANGED
|
@@ -518,14 +518,16 @@ export function toggleChecklist() {
|
|
|
518
518
|
if (selectedLis.length > 0) {
|
|
519
519
|
let firstP = null;
|
|
520
520
|
selectedLis.forEach((li) => {
|
|
521
|
-
const text = Array.from(li.childNodes)
|
|
522
|
-
.filter((n) => !(n.nodeType === 1 && n.tagName === 'INPUT'))
|
|
523
|
-
.map((n) => n.textContent)
|
|
524
|
-
.join('')
|
|
525
|
-
.replace(/\u00a0/g, ' ')
|
|
526
|
-
.trim();
|
|
527
521
|
const p = document.createElement('p');
|
|
528
|
-
|
|
522
|
+
for (const child of li.childNodes) {
|
|
523
|
+
if (child.nodeType === 1 && child.tagName === 'INPUT') continue;
|
|
524
|
+
p.appendChild(child.cloneNode(true));
|
|
525
|
+
}
|
|
526
|
+
p.innerHTML = p.innerHTML.replace(/\u200b/g, '');
|
|
527
|
+
if (!p.hasChildNodes() || !p.textContent.trim()) {
|
|
528
|
+
p.innerHTML = '';
|
|
529
|
+
p.appendChild(document.createTextNode('\u00a0'));
|
|
530
|
+
}
|
|
529
531
|
ul.parentNode.insertBefore(p, ul);
|
|
530
532
|
if (!firstP) firstP = p;
|
|
531
533
|
ul.removeChild(li);
|
package/src/js/index.js
CHANGED
|
@@ -140,7 +140,7 @@ const AutumnNote = {
|
|
|
140
140
|
registerButton(btnDef) { registerButton(btnDef); return this; },
|
|
141
141
|
|
|
142
142
|
/** Library version */
|
|
143
|
-
version: '1.4.
|
|
143
|
+
version: '1.4.2',
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
// ---------------------------------------------------------------------------
|