FE linting
Dieser Commit ist enthalten in:
Ursprung
39b947d003
Commit
2df920895d
3 geänderte Dateien mit 46 neuen und 67 gelöschten Zeilen
|
@ -14,7 +14,8 @@ import { uploadIcon } from "discourse/lib/uploads";
|
||||||
import { dasherize } from "@ember/string";
|
import { dasherize } from "@ember/string";
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
|
|
||||||
const IMAGE_MARKDOWN_REGEX = /!\[(.*?)\|(\d{1,4}x\d{1,4})(,\s*\d{1,3}%)?(.*?)\]\((upload:\/\/.*?)\)(?!(.*`))/g;
|
const IMAGE_MARKDOWN_REGEX =
|
||||||
|
/!\[(.*?)\|(\d{1,4}x\d{1,4})(,\s*\d{1,3}%)?(.*?)\]\((upload:\/\/.*?)\)(?!(.*`))/g;
|
||||||
|
|
||||||
export default ComposerEditor.extend({
|
export default ComposerEditor.extend({
|
||||||
classNameBindings: ["fieldClass"],
|
classNameBindings: ["fieldClass"],
|
||||||
|
@ -116,9 +117,8 @@ export default ComposerEditor.extend({
|
||||||
event.target.closest(".button-wrapper").dataset.imageIndex,
|
event.target.closest(".button-wrapper").dataset.imageIndex,
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
const matchingPlaceholder = this.get("composer.reply").match(
|
const matchingPlaceholder =
|
||||||
IMAGE_MARKDOWN_REGEX
|
this.get("composer.reply").match(IMAGE_MARKDOWN_REGEX);
|
||||||
);
|
|
||||||
|
|
||||||
this.session.set("wizardEventFieldId", this.field.id);
|
this.session.set("wizardEventFieldId", this.field.id);
|
||||||
this.appEvents.trigger(
|
this.appEvents.trigger(
|
||||||
|
|
|
@ -21,29 +21,8 @@ export default Controller.extend({
|
||||||
"application/x-www-form-urlencoded",
|
"application/x-www-form-urlencoded",
|
||||||
]),
|
]),
|
||||||
successCodes: selectKitContent([
|
successCodes: selectKitContent([
|
||||||
100,
|
100, 101, 102, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301,
|
||||||
101,
|
302, 303, 303, 304, 305, 306, 307, 308,
|
||||||
102,
|
|
||||||
200,
|
|
||||||
201,
|
|
||||||
202,
|
|
||||||
203,
|
|
||||||
204,
|
|
||||||
205,
|
|
||||||
206,
|
|
||||||
207,
|
|
||||||
208,
|
|
||||||
226,
|
|
||||||
300,
|
|
||||||
301,
|
|
||||||
302,
|
|
||||||
303,
|
|
||||||
303,
|
|
||||||
304,
|
|
||||||
305,
|
|
||||||
306,
|
|
||||||
307,
|
|
||||||
308,
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default {
|
||||||
};
|
};
|
||||||
|
|
||||||
withPluginApi("0.8.36", (api) => {
|
withPluginApi("0.8.36", (api) => {
|
||||||
api.onAppEvent('page:changed', (data) => {
|
api.onAppEvent("page:changed", (data) => {
|
||||||
const currentUser = container.lookup("service:current-user");
|
const currentUser = container.lookup("service:current-user");
|
||||||
const settings = container.lookup("service:site-settings");
|
const settings = container.lookup("service:site-settings");
|
||||||
const redirectToWizard = currentUser.redirect_to_wizard;
|
const redirectToWizard = currentUser.redirect_to_wizard;
|
||||||
|
@ -30,10 +30,10 @@ export default {
|
||||||
.concat(["loading"]);
|
.concat(["loading"]);
|
||||||
if (
|
if (
|
||||||
redirectToWizard &&
|
redirectToWizard &&
|
||||||
(data.currentRouteName !== "customWizardStep") &&
|
data.currentRouteName !== "customWizardStep" &&
|
||||||
!(excludedPaths.find((p) => {
|
!excludedPaths.find((p) => {
|
||||||
return data.currentRouteName.indexOf(p) > -1;
|
return data.currentRouteName.indexOf(p) > -1;
|
||||||
}))
|
})
|
||||||
) {
|
) {
|
||||||
window.location = "/w/" + redirectToWizard.dasherize();
|
window.location = "/w/" + redirectToWizard.dasherize();
|
||||||
}
|
}
|
||||||
|
@ -60,47 +60,47 @@ export default {
|
||||||
// Needed to ensure appEvents get registered when navigating between steps
|
// Needed to ensure appEvents get registered when navigating between steps
|
||||||
@observes("id")
|
@observes("id")
|
||||||
initOnStepChange() {
|
initOnStepChange() {
|
||||||
if(/ wizard - field | wizard - step /.test(this.id)) {
|
if (/ wizard - field | wizard - step /.test(this.id)) {
|
||||||
this._initialize();
|
this._initialize();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
api.modifyClass("component:d-editor", {
|
api.modifyClass("component:d-editor", {
|
||||||
pluginId: "custom-wizard",
|
pluginId: "custom-wizard",
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
if (this.wizardComposer) {
|
if (this.wizardComposer) {
|
||||||
this.appEvents.on(
|
this.appEvents.on(
|
||||||
`wizard-editor:insert-text`,
|
`wizard-editor:insert-text`,
|
||||||
this,
|
this,
|
||||||
"_wizardInsertText"
|
"_wizardInsertText"
|
||||||
);
|
);
|
||||||
this.appEvents.on(
|
this.appEvents.on(
|
||||||
"wizard-editor:replace-text",
|
"wizard-editor:replace-text",
|
||||||
this,
|
this,
|
||||||
"_wizardReplaceText"
|
"_wizardReplaceText"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_wizardInsertText(text, options) {
|
_wizardInsertText(text, options) {
|
||||||
if (
|
if (
|
||||||
this.session.wizardEventFieldId === this.fieldId &&
|
this.session.wizardEventFieldId === this.fieldId &&
|
||||||
this.element
|
this.element
|
||||||
) {
|
) {
|
||||||
this.insertText(text, options);
|
this.insertText(text, options);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_wizardReplaceText(oldVal, newVal, opts = {}) {
|
_wizardReplaceText(oldVal, newVal, opts = {}) {
|
||||||
if (this.session.wizardEventFieldId === this.fieldId) {
|
if (this.session.wizardEventFieldId === this.fieldId) {
|
||||||
this.replaceText(oldVal, newVal, opts);
|
this.replaceText(oldVal, newVal, opts);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Laden …
In neuem Issue referenzieren