1
0
Fork 0
Dieser Commit ist enthalten in:
merefield 2023-07-10 07:03:45 +01:00
Ursprung 39b947d003
Commit 2df920895d
3 geänderte Dateien mit 46 neuen und 67 gelöschten Zeilen

Datei anzeigen

@ -14,7 +14,8 @@ import { uploadIcon } from "discourse/lib/uploads";
import { dasherize } from "@ember/string";
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({
classNameBindings: ["fieldClass"],
@ -116,9 +117,8 @@ export default ComposerEditor.extend({
event.target.closest(".button-wrapper").dataset.imageIndex,
10
);
const matchingPlaceholder = this.get("composer.reply").match(
IMAGE_MARKDOWN_REGEX
);
const matchingPlaceholder =
this.get("composer.reply").match(IMAGE_MARKDOWN_REGEX);
this.session.set("wizardEventFieldId", this.field.id);
this.appEvents.trigger(

Datei anzeigen

@ -21,29 +21,8 @@ export default Controller.extend({
"application/x-www-form-urlencoded",
]),
successCodes: selectKitContent([
100,
101,
102,
200,
201,
202,
203,
204,
205,
206,
207,
208,
226,
300,
301,
302,
303,
303,
304,
305,
306,
307,
308,
100, 101, 102, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301,
302, 303, 303, 304, 305, 306, 307, 308,
]),
@discourseComputed(

Datei anzeigen

@ -21,7 +21,7 @@ export default {
};
withPluginApi("0.8.36", (api) => {
api.onAppEvent('page:changed', (data) => {
api.onAppEvent("page:changed", (data) => {
const currentUser = container.lookup("service:current-user");
const settings = container.lookup("service:site-settings");
const redirectToWizard = currentUser.redirect_to_wizard;
@ -30,10 +30,10 @@ export default {
.concat(["loading"]);
if (
redirectToWizard &&
(data.currentRouteName !== "customWizardStep") &&
!(excludedPaths.find((p) => {
data.currentRouteName !== "customWizardStep" &&
!excludedPaths.find((p) => {
return data.currentRouteName.indexOf(p) > -1;
}))
})
) {
window.location = "/w/" + redirectToWizard.dasherize();
}
@ -60,47 +60,47 @@ export default {
// Needed to ensure appEvents get registered when navigating between steps
@observes("id")
initOnStepChange() {
if(/ wizard - field | wizard - step /.test(this.id)) {
this._initialize();
}
},
if (/ wizard - field | wizard - step /.test(this.id)) {
this._initialize();
}
},
});
api.modifyClass("component:d-editor", {
pluginId: "custom-wizard",
api.modifyClass("component:d-editor", {
pluginId: "custom-wizard",
didInsertElement() {
this._super(...arguments);
didInsertElement() {
this._super(...arguments);
if (this.wizardComposer) {
this.appEvents.on(
`wizard-editor:insert-text`,
this,
"_wizardInsertText"
);
this.appEvents.on(
"wizard-editor:replace-text",
this,
"_wizardReplaceText"
);
}
},
if (this.wizardComposer) {
this.appEvents.on(
`wizard-editor:insert-text`,
this,
"_wizardInsertText"
);
this.appEvents.on(
"wizard-editor:replace-text",
this,
"_wizardReplaceText"
);
}
},
_wizardInsertText(text, options) {
if (
this.session.wizardEventFieldId === this.fieldId &&
this.element
) {
this.insertText(text, options);
}
},
_wizardInsertText(text, options) {
if (
this.session.wizardEventFieldId === this.fieldId &&
this.element
) {
this.insertText(text, options);
}
},
_wizardReplaceText(oldVal, newVal, opts = {}) {
if (this.session.wizardEventFieldId === this.fieldId) {
this.replaceText(oldVal, newVal, opts);
}
},
});
});
_wizardReplaceText(oldVal, newVal, opts = {}) {
if (this.session.wizardEventFieldId === this.fieldId) {
this.replaceText(oldVal, newVal, opts);
}
},
});
});
},
};