We hebben een probleem met aangepaste tags voor gebeurtenissen en de nieuwe WYSIWYG ProseMirror-editor: aangepaste velden die vanuit het gebeurtenisformulier zijn ingevuld, zijn niet aanwezig in de gegenereerde string. Het werkt nog steeds zoals voorheen met de markdown-editor.
Stappen om te reproduceren:
Schakel de Discourse Calendar-plugin in
Voeg één aangepast veld toe in de pluginconfiguratie
Open een formulier voor een nieuwe Post
Selecteer de ProseMirror-editor
Maak een gebeurtenis met een waarde voor het aangepaste veld (Opties > Gebeurtenis maken)
Valideer de gebeurtenis
Schakel over naar de Markdown-editor
Wat er gebeurt
Het aangepaste veld ontbreekt in de [event] tag.
Wat wordt verwacht
Het aangepaste veld moet aanwezig zijn in de [event] tag.
Opmerkingen
Wanneer hetzelfde wordt gedaan, maar beginnend met de Markdown-editor in plaats van ProseMirror, is het aangepaste veld aanwezig in de [event] tag.
Ik heb een beetje onderzocht wat er aan de hand was met de toolbarEvent bij het valideren van de nieuwe gebeurtenis: de addText() methode lijkt in beide gevallen de juiste markup te ontvangen:
I can’t find another plugin with the same feature, so it’s hard to find what’s wrong.
When validating the form, it calls this.args.model.toolbarEvent.addText() with the right text.
A few console.log™ lead me to : text-manipulation.js#addText() where this.convertFromMarkdown(text) gets called. It seems that the issue comes from here : there is a kind of schema enforced, and it does not contains the custom fields.
The issue comes from the editor extension discourse-calendar/assets/javascripts/discourse/pre-initializers/rich-editor-extension.js : the list of attributes used by convertFromMarkdown() is defined in the EVENT_ATTRIBUTES constant. It works when adding the custom field to the list.
There is nothing about custom fields in this file; I have no idea on how to complete this constant with all the custom fields; the extension seems to get registered early in the process.
Any idea welcome, it makes the plugin unusable with the new editor that can’t be disabled, so we’re stuck with Discourse 3.4.
Custom fields are indeed unsupported on the rich editor for now. We’ll investigate the best path forward.
It can – if you’re an admin, you can set SiteSettings.rich_editor = false via the console, which is still available as a last resort in cases like this.