DEV: Apply prettier, remove es6 extension

This commit is contained in:
David Taylor 2022-01-13 12:43:57 +00:00
parent 3adf5b8300
commit 6c43321b28
2 changed files with 23 additions and 23 deletions

View File

@ -12,7 +12,7 @@ export default Controller.extend(ModalFunctionality, {
EmberObject.create({ EmberObject.create({
key: null, key: null,
description: null, description: null,
values: [] values: [],
}) })
); );
}, },
@ -43,5 +43,5 @@ export default Controller.extend(ModalFunctionality, {
this.model.toolbarEvent.addText(`${output}][/wrap]`); this.model.toolbarEvent.addText(`${output}][/wrap]`);
this.send("closeModal"); this.send("closeModal");
} },
}); });

View File

@ -46,14 +46,14 @@ function buildSelect(key, placeholder) {
if (placeholder.description) { if (placeholder.description) {
addSelectOption(select, { addSelectOption(select, {
value: "none", value: "none",
description: placeholder.description description: placeholder.description,
}); });
} }
placeholder.defaults.forEach(value => placeholder.defaults.forEach((value) =>
addSelectOption(select, { addSelectOption(select, {
value, value,
selected: placeholder.default === value selected: placeholder.default === value,
}) })
); );
@ -64,7 +64,7 @@ export default {
name: "discourse-placeholder-theme-component", name: "discourse-placeholder-theme-component",
initialize() { initialize() {
withPluginApi("0.8.7", api => { withPluginApi("0.8.7", (api) => {
api.decorateCooked( api.decorateCooked(
($cooked, postWidget) => { ($cooked, postWidget) => {
if (!postWidget) return; if (!postWidget) return;
@ -103,7 +103,7 @@ export default {
let replaced = false; let replaced = false;
let newInnnerHTML = elem.innerHTML; let newInnnerHTML = elem.innerHTML;
mapping.forEach(m => { mapping.forEach((m) => {
if ( if (
m.pattern !== m.pattern !==
`${placeholder.delimiter}${key}${placeholder.delimiter}` `${placeholder.delimiter}${key}${placeholder.delimiter}`
@ -136,7 +136,7 @@ export default {
const keys = Object.keys(placeholders); const keys = Object.keys(placeholders);
const pattern = keys const pattern = keys
.map(key => { .map((key) => {
const placeholder = placeholders[key]; const placeholder = placeholders[key];
return `(${placeholder.delimiter}${key}${placeholder.delimiter})`; return `(${placeholder.delimiter}${key}${placeholder.delimiter})`;
}) })
@ -152,7 +152,7 @@ export default {
mappings[index].push({ mappings[index].push({
pattern: match[0], pattern: match[0],
position: match.index, position: match.index,
length: match[0].length length: match[0].length,
}); });
} }
}); });
@ -163,7 +163,7 @@ export default {
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) => {
const placeholder = placeholders[placeholderKey]; const placeholder = placeholders[placeholderKey];
const placeholderIdentifier = `${postIdentifier}${placeholderKey}`; const placeholderIdentifier = `${postIdentifier}${placeholderKey}`;
const value = const value =
@ -174,9 +174,9 @@ export default {
value, value,
dataset: { dataset: {
key: placeholderKey, key: placeholderKey,
delimiter: placeholder.delimiter delimiter: placeholder.delimiter,
} },
} },
}); });
}); });
} }
@ -186,7 +186,7 @@ export default {
".d-wrap[data-wrap=placeholder]:not(.placeholdered)" ".d-wrap[data-wrap=placeholder]:not(.placeholdered)"
); );
placeholderNodes.forEach(elem => { placeholderNodes.forEach((elem) => {
const dataKey = elem.dataset.key; const dataKey = elem.dataset.key;
if (!dataKey) return; if (!dataKey) return;
@ -201,7 +201,7 @@ export default {
default: valueFromCookie || elem.dataset.default, default: valueFromCookie || elem.dataset.default,
defaults: defaultValues, defaults: defaultValues,
delimiter: elem.dataset.delimiter || DELIMITER, delimiter: elem.dataset.delimiter || DELIMITER,
description: elem.dataset.description description: elem.dataset.description,
}; };
const span = document.createElement("span"); const span = document.createElement("span");
@ -225,10 +225,10 @@ export default {
}); });
$cooked $cooked
.on("input", ".discourse-placeholder-value", inputEvent => .on("input", ".discourse-placeholder-value", (inputEvent) =>
debounce(this, processChange, inputEvent, 150) debounce(this, processChange, inputEvent, 150)
) )
.on("change", ".discourse-placeholder-select", inputEvent => .on("change", ".discourse-placeholder-select", (inputEvent) =>
debounce(this, processChange, inputEvent, 150) debounce(this, processChange, inputEvent, 150)
); );
@ -241,7 +241,7 @@ export default {
return { return {
action: "insertPlaceholder", action: "insertPlaceholder",
icon: "file", icon: "file",
label: themePrefix("toolbar.builder") label: themePrefix("toolbar.builder"),
}; };
}); });
@ -252,12 +252,12 @@ export default {
insertPlaceholder() { insertPlaceholder() {
showModal("discourse-placeholder-builder", { showModal("discourse-placeholder-builder", {
model: { model: {
toolbarEvent: this.toolbarEvent toolbarEvent: this.toolbarEvent,
} },
}); });
} },
} },
}); });
}); });
} },
}; };