Re: PmSyntax and editing buttons

Petko Yotov <[email protected]>
Newsgroups gmane.comp.web.wiki.pmwiki.user
Message-ID <[email protected]>
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?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.