This is a migrated thread and some comments may be shown as answers.

Creating a new input rule does not seem to work

1 Answer 115 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Veteran
Iron
Martin asked on 13 Apr 2021, 07:47 AM

Hello,

Yesterday I got great help from Nikolay in creating a custom editor node, see https://www.telerik.com/forums/creating-a-custom-editor-node-with-html-inside. Now I would like to extend his solution so that when a user types (for example) `${name}`, it will be converted into my new node.

I looked at https://www.telerik.com/kendo-react-ui/components/editor/plugins/#toc-input-rules and tried to add this to the code solution from Nikolay. This is my StackBlitz so far: https://stackblitz.com/edit/react-y3dx71-uqujbr?file=app%2Fmain.jsx

On line 55, I added code for creating the new rule, and on line 78 I add the new rule to the editor plugins. But this does not seem to work, when I input something that I thought would match the rule, nothing happens.

What am I doing wrong here?

Also, I would like to add a condition to the rule: It should only be converted if the text matches one of the "code" props in the "shortcodes" array in InsertShortcodeTool.tsx. I tried looking at match property in the input rules documentation, but honestly I don't understand how it works.

1 Answer, 1 is accepted

Sort by
0
Martin
Top achievements
Rank 1
Veteran
Iron
answered on 13 Apr 2021, 03:20 PM

Answered in https://www.telerik.com/forums/creating-a-custom-editor-node-with-html-inside#hVs2yLeZzUeWh8q3u-gelw

Thanks for the help Nikolay :D

Tags
General Discussions
Asked by
Martin
Top achievements
Rank 1
Veteran
Iron
Answers by
Martin
Top achievements
Rank 1
Veteran
Iron
Share this question
or