make quote button allow preview without needing to edit
This commit is contained in:
@@ -141,7 +141,7 @@ export default class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#previousMarkup = '';
|
#previousMarkup = null;
|
||||||
async babycodePreview(ev, el) {
|
async babycodePreview(ev, el) {
|
||||||
if (ev.sender.classList.contains('active')) {
|
if (ev.sender.classList.contains('active')) {
|
||||||
return;
|
return;
|
||||||
@@ -151,11 +151,17 @@ export default class {
|
|||||||
const previewContainer = el.querySelector('#babycode-preview-container');
|
const previewContainer = el.querySelector('#babycode-preview-container');
|
||||||
const ta = document.getElementById('babycode-content');
|
const ta = document.getElementById('babycode-content');
|
||||||
const markup = ta.value.trim();
|
const markup = ta.value.trim();
|
||||||
if (markup === '' || markup === this.#previousMarkup) {
|
if (markup === '') {
|
||||||
previewErrorsContainer.textContent = 'Type something!';
|
previewErrorsContainer.textContent = 'Type something!';
|
||||||
previewContainer.textContent = '';
|
previewContainer.textContent = '';
|
||||||
|
this.#previousMarkup = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (markup === this.#previousMarkup) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const bannedTags = JSON.parse(document.getElementById('babycode-banned-tags').value);
|
const bannedTags = JSON.parse(document.getElementById('babycode-banned-tags').value);
|
||||||
this.#previousMarkup = markup;
|
this.#previousMarkup = markup;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user