The issue concerns custom fields not being inserted in the ProseMirror editor when creating events in the Discourse Calendar plugin. manut reports that while custom fields work with the markdown editor, they are missing in the WYSIWYG ProseMirror editor. The problem arises because the EVENT_ATTRIBUTES constant in the editor extension does not include custom fields, preventing them from being converted from markdown. manut identifies the root cause and notes that the addText() method receives the correct text but the conversion fails. renato confirms that custom fields are currently unsupported in the rich editor and that the team will investigate a solution.
יש לנו בעיה עם תגיות מותאמות אישית לאירועים ועורך ProseMirror החדש (WYSIWYG): שדות מותאמים אישית שמולאו מטופס האירוע אינם קיימים במחרוזת שנוצרה. זה עדיין עובד כרגיל עם עורך ה-Markdown.
שלבים לשחזור:
הפעל את התוסף Discourse Calendar
הוסף שדה מותאם אישית אחד בתצורת התוסף
פתח טופס לפוסט חדש
בחר את עורך ProseMirror
צור אירוע עם ערך עבור השדה המותאם אישית (אפשרויות > צור אירוע)
אשר את האירוע
עבור לעורך Markdown
מה קורה
השדה המותאם אישית חסר מתג ה-[event].
מה מצופה
השדה המותאם אישית אמור להיות קיים בתג ה-[event].
הערות
כשעושים את אותו הדבר אך מתחילים עם עורך ה-Markdown במקום ProseMirror, השדה המותאם אישית קיים בתג ה-[event].
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.