DEV: Remove JQuery
This commit is contained in:
parent
468cf81fd2
commit
9882e993c5
|
@ -128,8 +128,8 @@ export default {
|
||||||
this.expireOldValues();
|
this.expireOldValues();
|
||||||
|
|
||||||
withPluginApi("0.8.7", (api) => {
|
withPluginApi("0.8.7", (api) => {
|
||||||
api.decorateCooked(
|
api.decorateCookedElement(
|
||||||
($cooked, postWidget) => {
|
(cooked, postWidget) => {
|
||||||
if (!postWidget) return;
|
if (!postWidget) return;
|
||||||
|
|
||||||
const postIdentifier = `${postWidget.widget.attrs.topicId}-${postWidget.widget.attrs.id}-`;
|
const postIdentifier = `${postWidget.widget.attrs.topicId}-${postWidget.widget.attrs.id}-`;
|
||||||
|
@ -157,7 +157,7 @@ export default {
|
||||||
newValue = `${placeholder.delimiter}${key}${placeholder.delimiter}`;
|
newValue = `${placeholder.delimiter}${key}${placeholder.delimiter}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cooked.find(VALID_TAGS).each((index, elem) => {
|
cooked.querySelectorAll(VALID_TAGS).forEach((elem, index) => {
|
||||||
const mapping = mappings[index];
|
const mapping = mappings[index];
|
||||||
|
|
||||||
if (!mapping) return;
|
if (!mapping) return;
|
||||||
|
@ -206,7 +206,7 @@ export default {
|
||||||
.join("|");
|
.join("|");
|
||||||
const regex = new RegExp(pattern, "g");
|
const regex = new RegExp(pattern, "g");
|
||||||
|
|
||||||
$cooked.find(VALID_TAGS).each((index, elem) => {
|
cooked.querySelectorAll(VALID_TAGS).forEach((elem, index) => {
|
||||||
let match;
|
let match;
|
||||||
|
|
||||||
mappings[index] = mappings[index] || [];
|
mappings[index] = mappings[index] || [];
|
||||||
|
@ -223,7 +223,7 @@ export default {
|
||||||
|
|
||||||
const _fillPlaceholders = () => {
|
const _fillPlaceholders = () => {
|
||||||
if (Object.keys(placeholders).length > 0) {
|
if (Object.keys(placeholders).length > 0) {
|
||||||
processPlaceholders(placeholders, $cooked, mappings);
|
processPlaceholders(placeholders, cooked, mappings);
|
||||||
|
|
||||||
// trigger fake event to setup initial state
|
// trigger fake event to setup initial state
|
||||||
Object.keys(placeholders).forEach((placeholderKey) => {
|
Object.keys(placeholders).forEach((placeholderKey) => {
|
||||||
|
@ -245,7 +245,7 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const placeholderNodes = $cooked[0].querySelectorAll(
|
const placeholderNodes = cooked.querySelectorAll(
|
||||||
".d-wrap[data-wrap=placeholder]:not(.placeholdered)"
|
".d-wrap[data-wrap=placeholder]:not(.placeholdered)"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -287,13 +287,16 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$cooked
|
cooked
|
||||||
.on("input", ".discourse-placeholder-value", (inputEvent) =>
|
.querySelectorAll(".discourse-placeholder-value")
|
||||||
debounce(this, processChange, inputEvent, 150)
|
.forEach((el) => {
|
||||||
)
|
el.addEventListener("input", (inputEvent) =>
|
||||||
.on("change", ".discourse-placeholder-select", (inputEvent) =>
|
debounce(this, processChange, inputEvent, 150)
|
||||||
debounce(this, processChange, inputEvent, 150)
|
);
|
||||||
);
|
el.addEventListener("change", (inputEvent) =>
|
||||||
|
debounce(this, processChange, inputEvent, 150)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
later(_fillPlaceholders, 500);
|
later(_fillPlaceholders, 500);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue