Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2022-06-08 21:33:40
- Myusername
- Member
- Registered: 2019-12-12
- Posts: 165
monaco editor
I’m developing a plugin to add Monaco Editor to Textapattern. I’ve already done some of the work:
- Editor is added below Textpattern’s textarea
- The textarea is hidden
- The content of the textarea is sent to the editor
- When changing the content of the editor, it is sent to the textarea for Textpattern to save it normally
So far so good, but as the forms can have the most varied mimetypes, I added a <select>
element with several language options, the user can change dynamically.
However, I would like this mimetype type to be directly tied to this form. So I did a little more:
- When installing the plugin, a new column is added to the txp_form table
The idea is that when the user saves the form, the select value is saved in that column. So each form would have its syntax.
But I can’t think of a way to save the value of the select in that column created. How can I do this? The plugin is here and it loads monaco via cdn, if anyone can take a look and help me I’d be grateful.
Last edited by Myusername (2022-06-08 23:50:32)
Offline
Re: monaco editor
Amazing. You might try to look at form_saved
callback, which sends old/new form name on form save. You could then update your column with doSlash(ps('abc_editor_lang_select'))
value. This yields two table updates on save, but I see no better way (we should think of it, though).
Also, you could target UI elements more precisely:
register_callback('abc_editor_form_tab', 'form_ui', 'inputlabel.form');
and so on, to avoid unnecessary calls.
Offline
#3 2022-06-09 14:52:14
- Myusername
- Member
- Registered: 2019-12-12
- Posts: 165
Re: monaco editor
Thanks for the reply, I’ll try to do that later.
Offline
Pages: 1