dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
860 stars 467 forks source link

Edit Contentlet: Allow WYSIWYG user setting systemwide TinyMCE props #28097

Closed rjvelazco closed 5 months ago

rjvelazco commented 6 months ago

Parent Issue

https://github.com/dotCMS/core/issues/25445

Task

Proposed Objective

Core Features

Proposed Priority

Priority 3 - Average

Acceptance Criteria

Uses should be able to configure the WYSIWYG field through a JSON file.

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

rjvelazco commented 6 months ago

Steps for QA

  1. Create a new file: /application/apivtl/tinymceprops/get.vtl
  2. Add a valid tinyMCE configuration .json.
  3. Go to Edit > Rich Text
  4. See the tinyMCE.

Here is an example of TinyMCE JSON based on user role:

$response.addHeader("Content-Type", "application/json")

## Show full featured editor for "Reviewer"
#if($cmsuser.isUserRole($user, "Reviewer"))
{
   "selector":"textarea",
   "menubar":true,
   "statusbar":true,
   "resize":"both",
   "plugins": "advlist autolink lists link image charmap preview anchor pagebreak searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking save table directionality emoticons template",
   "toolbar1":"bold italic underline strikethrough",
   "paste_auto_cleanup_on_paste":true,
   "paste_strip_class_attributes":"all",
   "convert_urls":true,
   "cleanup":true,
   "browser_spellcheck":true,
   "verify_css_classes":false,
   "trim_span_elements":false,
   "apply_source_formatting":true,
   "valid_elements":"*[*]",
   "relative_urls":true,
   "document_base_url":"/",
   "plugin_insertdate_dateFormat":"%Y-%m-%d",
   "plugin_insertdate_timeFormat":"%H:%M:%S",
   "paste_use_dialog":true,
   "gecko_spellcheck":true,
   "image_advtab":true
}
## show simple editor to everyone else
#else
    {    
        "theme": "simple",
        "menubar": false,
        "resize": false
    }
#end

Note:

You must use the new Edit Content.

fmontes commented 6 months ago
buildDate   4/8/2024 3:50 PM
buildNumber 8aaabad
name    dotcms-core
releaseInfo dotcms-core 1.0.0-SNAPSHOT (April 08, 2024 3:50 PM)
serverInfo  dotcms-core / 1.0.0-SNAPSHOT
version 1.0.0-SNAPSHOT
josemejias11 commented 6 months ago

Approved: Tested on trunk_1afdb08, Docker, macOS 13.0, FF v124.0.2