overtype 2.3.6 → 2.3.7
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 +7 -2
- package/dist/overtype-webcomponent.esm.js +18 -7
- package/dist/overtype-webcomponent.esm.js.map +2 -2
- package/dist/overtype-webcomponent.js +18 -7
- package/dist/overtype-webcomponent.js.map +2 -2
- package/dist/overtype-webcomponent.min.js +40 -40
- package/dist/overtype.cjs +18 -7
- package/dist/overtype.cjs.map +2 -2
- package/dist/overtype.esm.js +18 -7
- package/dist/overtype.esm.js.map +2 -2
- package/dist/overtype.js +18 -7
- package/dist/overtype.js.map +2 -2
- package/dist/overtype.min.js +41 -41
- package/package.json +1 -1
- package/src/overtype.js +16 -6
- package/src/parser.js +3 -3
package/src/overtype.js
CHANGED
|
@@ -189,7 +189,7 @@ class OverType {
|
|
|
189
189
|
|
|
190
190
|
// Call onChange if provided
|
|
191
191
|
if (this.options.onChange) {
|
|
192
|
-
this.
|
|
192
|
+
this._notifyChange();
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -747,17 +747,21 @@ class OverType {
|
|
|
747
747
|
this._updateStats();
|
|
748
748
|
}
|
|
749
749
|
|
|
750
|
-
// Trigger onChange callback
|
|
751
|
-
if (this.options.onChange && this.initialized) {
|
|
752
|
-
this.options.onChange(text, this);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
750
|
// Trigger onRender callback
|
|
756
751
|
if (this.options.onRender) {
|
|
757
752
|
this.options.onRender(this.preview, isPreviewMode ? 'preview' : 'normal', this);
|
|
758
753
|
}
|
|
759
754
|
}
|
|
760
755
|
|
|
756
|
+
/**
|
|
757
|
+
* Notify listeners that the editor value changed
|
|
758
|
+
* @private
|
|
759
|
+
*/
|
|
760
|
+
_notifyChange() {
|
|
761
|
+
if (!this.options.onChange || !this.initialized) return;
|
|
762
|
+
this.options.onChange(this.textarea.value, this);
|
|
763
|
+
}
|
|
764
|
+
|
|
761
765
|
/**
|
|
762
766
|
* Apply background styling to code blocks
|
|
763
767
|
* @private
|
|
@@ -806,6 +810,7 @@ class OverType {
|
|
|
806
810
|
*/
|
|
807
811
|
handleInput(event) {
|
|
808
812
|
this.updatePreview();
|
|
813
|
+
this._notifyChange();
|
|
809
814
|
}
|
|
810
815
|
|
|
811
816
|
/**
|
|
@@ -1059,6 +1064,7 @@ class OverType {
|
|
|
1059
1064
|
* @param {string} value - Markdown content to set
|
|
1060
1065
|
*/
|
|
1061
1066
|
setValue(value) {
|
|
1067
|
+
const didChange = this.textarea.value !== value;
|
|
1062
1068
|
this.textarea.value = value;
|
|
1063
1069
|
this.updatePreview();
|
|
1064
1070
|
|
|
@@ -1066,6 +1072,10 @@ class OverType {
|
|
|
1066
1072
|
if (this.options.autoResize) {
|
|
1067
1073
|
this._updateAutoHeight();
|
|
1068
1074
|
}
|
|
1075
|
+
|
|
1076
|
+
if (didChange) {
|
|
1077
|
+
this._notifyChange();
|
|
1078
|
+
}
|
|
1069
1079
|
}
|
|
1070
1080
|
|
|
1071
1081
|
/**
|
package/src/parser.js
CHANGED
|
@@ -134,15 +134,15 @@ export class MarkdownParser {
|
|
|
134
134
|
* @returns {string} Parsed task list item
|
|
135
135
|
*/
|
|
136
136
|
static parseTaskList(html, isPreviewMode = false) {
|
|
137
|
-
return html.replace(/^((?: )*)
|
|
137
|
+
return html.replace(/^((?: )*)-(\s+)\[([ xX])\](\s*)(.*)$/, (match, indent, spacingBeforeBox, checked, spacingAfterBox, content) => {
|
|
138
138
|
content = this.parseInlineElements(content);
|
|
139
139
|
if (isPreviewMode) {
|
|
140
140
|
// Preview mode: render actual checkbox
|
|
141
141
|
const isChecked = checked.toLowerCase() === 'x';
|
|
142
142
|
return `${indent}<li class="task-list"><input type="checkbox" ${isChecked ? 'checked' : ''}> ${content}</li>`;
|
|
143
143
|
} else {
|
|
144
|
-
// Normal mode: keep syntax visible for alignment
|
|
145
|
-
return `${indent}<li class="task-list"><span class="syntax-marker"
|
|
144
|
+
// Normal mode: keep syntax (including user spacing) visible for alignment
|
|
145
|
+
return `${indent}<li class="task-list"><span class="syntax-marker">-${spacingBeforeBox}[${checked}]${spacingAfterBox}</span>${content}</li>`;
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
}
|