DEV: make composer-upload-uppy more flexible

This commit is contained in:
Mark VanLandingham 2021-08-27 11:56:46 -05:00 committed by GitHub
parent 31db83527b
commit db0429da1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -9,4 +9,6 @@ export default ComposerEditor.extend(ComposerUploadUppy, {
uploadType: "composer",
uppyId: "composer-editor-uppy",
composerModel: alias("composer"),
composerModelContentKey: "reply",
editorInputClass: ".d-editor-input",
});

View File

@ -334,9 +334,9 @@ export default Mixin.create({
filename: escapedFilename + "(?:\\()?([0-9])?(?:\\))?",
})}\\]\\(\\)`;
const globalRegex = new RegExp(regexString, "g");
const matchingPlaceholder = this.get("composerModel.reply").match(
globalRegex
);
const matchingPlaceholder = this.get(
`composerModel.${this.composerModelContentKey}`
).match(globalRegex);
if (matchingPlaceholder) {
// get last matching placeholder and its consecutive nr in regex
// capturing group and apply +1 to the placeholder
@ -525,7 +525,7 @@ export default Mixin.create({
_bindPasteListener() {
this.pasteEventListener = function pasteListener(event) {
if (
document.activeElement !== document.querySelector(".d-editor-input")
document.activeElement !== document.querySelector(this.editorInputClass)
) {
return;
}