overtype 2.0.5 → 2.0.6
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 +3 -3
- package/dist/overtype-webcomponent.esm.js +29 -4
- package/dist/overtype-webcomponent.esm.js.map +2 -2
- package/dist/overtype-webcomponent.js +29 -4
- package/dist/overtype-webcomponent.js.map +2 -2
- package/dist/overtype-webcomponent.min.js +4 -4
- package/dist/overtype.cjs +29 -4
- package/dist/overtype.cjs.map +2 -2
- package/dist/overtype.esm.js +29 -4
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +31 -4
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +6 -4
- package/package.json +1 -1
- package/src/overtype.js +8 -3
- package/src/parser.js +5 -4
- package/src/toolbar.js +28 -0
package/dist/overtype.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OverType v2.0.
|
|
2
|
+
* OverType v2.0.6
|
|
3
3
|
* A lightweight markdown editor library with perfect WYSIWYG alignment
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author David Miranda
|
|
@@ -91,7 +91,7 @@ var MarkdownParser = class {
|
|
|
91
91
|
* @returns {string} Parsed bullet list item
|
|
92
92
|
*/
|
|
93
93
|
static parseBulletList(html) {
|
|
94
|
-
return html.replace(/^((?: )*)([
|
|
94
|
+
return html.replace(/^((?: )*)([-*+])\s(.+)$/, (match, indent, marker, content) => {
|
|
95
95
|
return `${indent}<li class="bullet-list"><span class="syntax-marker">${marker} </span>${content}</li>`;
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -150,7 +150,7 @@ var MarkdownParser = class {
|
|
|
150
150
|
* @returns {string} HTML with italic styling
|
|
151
151
|
*/
|
|
152
152
|
static parseItalic(html) {
|
|
153
|
-
html = html.replace(new RegExp("(
|
|
153
|
+
html = html.replace(new RegExp("(?<![\\*>])\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)", "g"), '<em><span class="syntax-marker">*</span>$1<span class="syntax-marker">*</span></em>');
|
|
154
154
|
html = html.replace(new RegExp("(?<=^|\\s)_(?!_)(.+?)(?<!_)_(?!_)(?=\\s|$)", "g"), '<em><span class="syntax-marker">_</span>$1<span class="syntax-marker">_</span></em>');
|
|
155
155
|
return html;
|
|
156
156
|
}
|
|
@@ -2762,6 +2762,28 @@ var Toolbar = class {
|
|
|
2762
2762
|
button.addEventListener("click", button._clickHandler);
|
|
2763
2763
|
return button;
|
|
2764
2764
|
}
|
|
2765
|
+
/**
|
|
2766
|
+
* Handle button action programmatically (used by keyboard shortcuts)
|
|
2767
|
+
* @param {Object} buttonConfig - Button configuration object with action function
|
|
2768
|
+
*/
|
|
2769
|
+
async handleAction(buttonConfig) {
|
|
2770
|
+
this.editor.textarea.focus();
|
|
2771
|
+
try {
|
|
2772
|
+
if (buttonConfig.action) {
|
|
2773
|
+
await buttonConfig.action({
|
|
2774
|
+
editor: this.editor,
|
|
2775
|
+
getValue: () => this.editor.getValue(),
|
|
2776
|
+
setValue: (value) => this.editor.setValue(value),
|
|
2777
|
+
event: null
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2780
|
+
} catch (error) {
|
|
2781
|
+
console.error(`Action "${buttonConfig.name}" error:`, error);
|
|
2782
|
+
this.editor.wrapper.dispatchEvent(new CustomEvent("button-error", {
|
|
2783
|
+
detail: { buttonName: buttonConfig.name, error }
|
|
2784
|
+
}));
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2765
2787
|
/**
|
|
2766
2788
|
* Sanitize SVG to prevent XSS
|
|
2767
2789
|
*/
|
|
@@ -3700,10 +3722,13 @@ var _OverType = class _OverType {
|
|
|
3700
3722
|
*/
|
|
3701
3723
|
handleKeydown(event) {
|
|
3702
3724
|
if (event.key === "Tab") {
|
|
3703
|
-
event.preventDefault();
|
|
3704
3725
|
const start = this.textarea.selectionStart;
|
|
3705
3726
|
const end = this.textarea.selectionEnd;
|
|
3706
3727
|
const value = this.textarea.value;
|
|
3728
|
+
if (event.shiftKey && start === end) {
|
|
3729
|
+
return;
|
|
3730
|
+
}
|
|
3731
|
+
event.preventDefault();
|
|
3707
3732
|
if (start !== end && event.shiftKey) {
|
|
3708
3733
|
const before = value.substring(0, start);
|
|
3709
3734
|
const selection = value.substring(start, end);
|