[pmwiki-users] PmSyntax and editing buttons
Petko Yotov
5ko at 5ko.fr
Fri May 12 07:50:17 PDT 2023
If you are using the standard $GUIButtons as shown in the documentation,
or calling the core functions to insert text, that is insertText(), then
it "should" work. Try it on the WikiSandbox:
https://www.pmwiki.org/wiki/Main/WikiSandbox?action=edit
If it doesn't work for some reason, it may be a bug or an omission and
I'd be interested in tracking it and fixing it.
Now, if you have custom functions that insert code by directly
manipulating the text.value property, after doing that you also need to
trigger one "input" event:
var evt = new Event('input');
document.getElementById('text').dispatchEvent(evt);
Unlike other DOM elements, changes in textarea value cannot be detected
by a MutationObserver. The only other option I know and even used at
some point, is to check the value every 50-100 milliseconds. This uses
up a lot of CPU and battery, so I removed it.
Petko
On 12/05/2023 15:54, Johan Bengtsson wrote:
> I noticed this when having syntax highlighting enabled for the edit
> area: When inserting code via the edit buttons, I must press return
> for the code to be visible.
>
> This is surely a bug?
More information about the pmwiki-users
mailing list