Home > Blockchain >  tinymce automatic list items
tinymce automatic list items

Time:11-01

I am using the tinymce lib. this is my code:

<div class="beschreibung"></div>

<script>
tinymce.init({
   selector: '.beschreibung',
   inline: true,
   menubar: false,
   skin: "oxide-dark",
   toolbar: 'bold italic bullist',
   plugins: ['lists','autoresize'],
   toolbar_location: 'bottom',
   language: 'de'
}); 
</script>

This works fine.

Example:

enter image description here

But now I would realize an automatic creation of list items. My idea:

I write "- " (a single line with a space) This should create a list item automatically.

Is there a tinymce solution available ?

CodePudding user response:

The textpattern plugin provides this functionality for TinyMCE. It will match against certain patterns while typing and perform an action, such as converting a line starting with - into a list when pressing enter. You can add other custom patterns as well by configuring the textpattern_patterns setting, however the default should do what you require.

See https://www.tiny.cloud/docs/plugins/opensource/textpattern/ for more information.

  • Related