[SOLVED] Adding Editor-Toolbar-Button -> select marked Text for macro

Hi,

I’ve added a toolbar button to quickly access the code macro in the wysiwyg editor following this guide.

Code I added looks like this:

> config['xwiki-macro'] = config['xwiki-macro'] || {};
> config['xwiki-macro'].insertButtons = [
>   {
>     commandId: 'xwiki-macro-insert-code-sql',
>     macroCall: {
>       name: 'code',
>       parameters: {
>         language: "sql"
>       }
>     }
>   }
> ];

Problem is, when I mark text on the wikipage and click on the button, it doesn’t use that marked text on the macro.

For example:
If I mark “Lorem ipsum dolor” → press the standard xwiki-macro-button (not my added one) → select code-macro → then “Lorem ipsum dolor” is already filled in, when the macro popup opens.

When I do this with my button, the contents of the popup window are empty (except for language=sql).

Is there a way, I can achieve this? couldnt find a solution searching.

Greetings

It’s a bug. Would be great if you can report it on Loading... . I checked the code and I know what needs to be fixed. I will release a new version in the following days so you will be able to upgrade your CKEditor Integration version from the Extension Manager in the Wiki Administration.

Thanks,
Marius

Thank you very much, this would increase usability and comfort a lot :slight_smile: .

Link to Bug-Report

Fixed. I will release a new version by the end of the week.

Thanks,
Marius

I’ve tried to update “CKEditor Integration” to 1.33 but it throws an error:

Dependency [org.xwiki.contrib:application-ckeditor-webjar-1.33] is not compatible with core extension feature [org.xwiki.contrib:application-ckeditor-webjar/1.32] ([org.xwiki.contrib:application-ckeditor-webjar/1.32])

When I look for “CKEditor WebJar” and click on 1.33 there is no button to install. Clicking on “Source” gets me to a 404-Github page.

Am I doing something wrong?

No… unfortunately there’s a regression in 11.2 that prevents upgrading CKEditor. I just reported Loading... . See the workaround in the comments.

I updated to XWiki 11.3 today and the Editor Update & my requested “Feature” works perfectly fine now.

Thank you for your responses and the solution.

I wrote a new Macro. It has one string parameter. Its not prefilled when I call the macro with the selected text.
How can it be done?
The macro only make a specialized link with the parameter.
Thank you

ATM we support prefilling only the macro content with the selected text.

And BTW, please open a new thread instead of hijacking old threads that are solved. Thanks.