0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-18 23:01:11 +02:00

DEV: fallback to core composerEditorInit

Dieser Commit ist enthalten in:
Angus McLeod 2024-06-04 12:04:15 +02:00
Ursprung 6e66d159c2
Commit 883bd6d96c
2 geänderte Dateien mit 7 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -39,25 +39,11 @@ export default ComposerEditor.extend({
@on("didInsertElement") @on("didInsertElement")
_composerEditorInit() { _composerEditorInit() {
const $input = $(this.element.querySelector(".d-editor-input")); this._super(...arguments);
if (this.siteSettings.enable_mentions) { if (this.siteSettings.mentionables_enabled) {
$input.autocomplete({ const $input = $(this.element.querySelector(".d-editor-input"));
template: findRawTemplate("user-selector-autocomplete"),
dataSource: (term) => this._userSearchTerm.call(this, term),
key: "@",
transformComplete: (v) => v.username || v.name,
afterComplete: (value) => {
this.composer.set("reply", value);
scheduleOnce("afterRender", () => $input.blur().focus());
},
triggerRule: (textarea) =>
!inCodeBlock(textarea.value, caretPosition(textarea)),
});
}
const siteSettings = this.siteSettings;
if (siteSettings.mentionables_enabled) {
Site.currentProp("mentionable_items", this.wizard.mentionable_items); Site.currentProp("mentionable_items", this.wizard.mentionable_items);
const { SEPARATOR } = requirejs( const { SEPARATOR } = requirejs(
"discourse/plugins/discourse-mentionables/discourse/lib/discourse-markdown/mentionable-items" "discourse/plugins/discourse-mentionables/discourse/lib/discourse-markdown/mentionable-items"
@ -75,15 +61,14 @@ export default ComposerEditor.extend({
}, },
transformComplete: (item) => item.model.slug, transformComplete: (item) => item.model.slug,
dataSource: (term) => dataSource: (term) =>
term.match(/\s/) ? null : searchMentionableItem(term, siteSettings), term.match(/\s/)
? null
: searchMentionableItem(term, this.siteSettings),
triggerRule: (textarea) => triggerRule: (textarea) =>
!inCodeBlock(textarea.value, caretPosition(textarea)), !inCodeBlock(textarea.value, caretPosition(textarea)),
}); });
} }
$input.on("scroll", this._throttledSyncEditorAndPreviewScroll);
this._bindUploadTarget();
const field = this.field; const field = this.field;
this.editorInputClass = `.${dasherize(field.type)}-${dasherize( this.editorInputClass = `.${dasherize(field.type)}-${dasherize(
field.id field.id

Datei anzeigen

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# name: discourse-custom-wizard # name: discourse-custom-wizard
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more. # about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
# version: 2.6.9 # version: 2.6.10
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos # authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
# url: https://github.com/paviliondev/discourse-custom-wizard # url: https://github.com/paviliondev/discourse-custom-wizard
# contact_emails: development@pavilion.tech # contact_emails: development@pavilion.tech