[pmwiki-users] PmSyntax and editing buttons

Johan Bengtsson elijah at chalmers.se
Mon May 15 01:26:48 PDT 2023


It is just standard buttons, no custom stuff. It works like it should for me in the pmwiki.org sandbox.

I tried disabling a lot of the recipes for the wiki, but that did not help.

-Johan Bengtsson

________________________________________
From: Petko Yotov <5ko at 5ko.fr>
Sent: Friday, May 12, 2023 16:50
To: Johan Bengtsson
Cc: PmWiki Users
Subject: Re: [pmwiki-users] PmSyntax and editing buttons

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