cogentcore / core

A free and open source framework for building powerful, fast, elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the web with a single Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.69k stars 80 forks source link

Support WYSIWYG text editor #1198

Open suntong opened 2 weeks ago

suntong commented 2 weeks ago

Describe the feature

Can tinymce be supported so as it goes smoothly with cogentcore forms?

See

Basically the web page source should looks something like this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <script src="/path/or/uri/to/tinymce.min.js" referrerpolicy="origin"></script>
    <script>
      tinymce.init({
        selector: '#mytextarea',
        plugins: 'powerpaste casechange searchreplace autolink directionality visualblocks visualchars image link media mediaembed codesample table charmap pagebreak nonbreaking anchor tableofcontents insertdatetime advlist lists checklist wordcount tinymcespellchecker editimage help formatpainter permanentpen charmap linkchecker emoticons advtable export autosave',
        toolbar: 'undo redo print spellcheckdialog formatpainter | blocks fontfamily fontsize | bold italic underline forecolor backcolor | link image | alignleft aligncenter alignright alignjustify',
        license_key: 'gpl|<your-license-key>'
      });
    </script>
  </head>

  <body>
    <h1>TinyMCE Quick Start Guide</h1>
    <form method="post">
      <textarea id="mytextarea">Hello, World!</textarea>
    </form>
  </body>
</html>

I guess the answer would be "yes", but I'd appreciate a more hands-on example. thanks!

Relevant code

No response

kkoreilly commented 1 week ago

Unfortunately, the way Cogent Core is structured, it is not compatible with other JS libraries that control widgets such as tinymce. However, we could add similar functionality to Cogent Core itself at some point.