Skip to main content
19 votes
Accepted

Change {{media url="wysiwyg/image.jpg"}} in frontend in custom module

You can filter its using filter() function, $content = 'This is test demo imgage, {{media url="wysiwyg/some_image.jpg"}}'; $om = \Magento\Framework\App\ObjectManager::getInstance(); $filterManager = $...
Rakesh Jesadiya's user avatar
17 votes
Accepted

Add WYSIWYG Editor to Block Form in Magento 2

Discovered I was missing the Config setting: /** * @var \Magento\Cms\Model\Wysiwyg\Config */ protected $_wysiwygConfig; /** * @param \Magento\Backend\Block\Template\Context $context * @param \...
tim.baker's user avatar
  • 843
15 votes
Accepted

Magento 2.3 - TinyMCE4 Toolbar and Plugin Configuration

UPDATE: Per Magefan's below comments, you can install this editor fix via composer. Instructions in their Github Repo. Original answer: Create an afterGetConfig plugin to configure Magento 2.3's ...
Mike Dubs's user avatar
  • 505
12 votes
Accepted

Magento 2: Get WYSIWYG editor's data in frontend?

Let's say the block that displays your content is called Vendor\Module\Block\Entity. Add a dependency Zend_Filter_Interface to your block like this: protected $templateProcessor; public function ...
Marius's user avatar
  • 198k
12 votes
Accepted

How to make field as WYSIWYG editor in system.xml in configuration?

Add this in your system.xml file <field id="grid_view" translate="label comment" type="editor" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Grid View</...
Kishan Savaliya's user avatar
11 votes

Magento 2 how to add product attribute of type textarea with editor programmatically

I have use this script to add custom attribute in products. It's working fine for me. /** @var EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); /** ...
Dharmendra Jadav's user avatar
10 votes
Accepted

Cannot edit widgets in WYSIWYG editor anymore

Apparently it is not related to the patch, but to the latest Chrome update (Chrome 58) which got rolled out around the same time. TinyMCE uses deprecated features that were removed in that version. ...
Fabian Schmengler's user avatar
9 votes
Accepted

Convert WYSIWYG content into html in magento2

Let's say your popup has a block behind it to handle the logic, and a template to render the result (as it should have). Let's say your block class is \Vendor\Module\Block\Popup Add this to your ...
Marius's user avatar
  • 198k
8 votes

Magento 2 WYSIWYG Media image directive using admin url

This is a known bug which is still present in CE 2.1.5. The known fix is to add 'add_directives' => true to getConfig function ofvendor/magento/module-cms/Model/Wysiwyg/Config.php. The best way ...
Konstantin Gerasimov's user avatar
7 votes

Change {{media url="wysiwyg/image.jpg"}} in frontend in custom module

You need declare this Class in constructor of Block: Magento\Cms\Model\Template\FilterProvider $filterProvider $content = '{{media url="wysiwyg/some_image.jpg"}}'; $contentGenerating = $this->...
LinoPham's user avatar
  • 3,778
7 votes
Accepted

Magento 2.3.0 WYSIWYG editor's image not loading on frontend

You need to filter that content using cms page filter. Try following way: public function __construct( \Magento\Cms\Model\Template\FilterProvider $filterProvider ) { $this->_filterProvider = ...
Sohel Rana's user avatar
  • 35.9k
6 votes

Magento 2.1: create a WYSIWYG field in a custom widget

You follow the this url for creating custom widgets. Now as per your requirement for WYSIWYG editor. Open widget.xml file and add new parameter, the code is below. etc/widget.xml <?xml version=&...
Kishor Hase's user avatar
6 votes
Accepted

Using wysiwyg editor on frontend templates in magento 2

In frontend suppose we want wysiwyg-editor on a textarea and textarea having id : description <textarea id="description" name="textarea_name"></textarea> and use below script to load ...
Kanhaiya lal's user avatar
  • 1,548
6 votes

Modify WYSIWYG or TinyMCE configurations in magento 2

I encountered the same problem, solved it by follow way. Navigate to Dashboard > store > settings > Configuration > general > content management > WYSIWYG Options > Enable ...
Key Shang's user avatar
  • 3,425
6 votes

How to create custom category attribute with wysiwyg editor in magento2?

Please follow the below steps to create a custom Category attribute and add it as WYSIWYG Editor in Category form. Step 1: Create custom attribute through Install or Upgrade Script. Below is an ...
Agnes's user avatar
  • 787
6 votes
Accepted

Magento 2 - How to add wysiwyg editor in frontend PHTML file?

Suppose you have a textarea: <textarea name="comment" id="comment" class="input-text"></textarea> then to add wysiwyg editor to the textarea, you just need to write following code in ...
Mohit Kumar Arora's user avatar
5 votes

Wrong URL returned by WYSIWYG editor for images

the error is due to Mage::getBaseUrl('media') does not pass the store parameter ! To solve this bug, change in : app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php Find function : ...
Flo69's user avatar
  • 161
5 votes
Accepted

How to add WYSIWYG functionality on my custom Magento 2 module?

Add following code in your file. app/code/Namespace/Modulename/Block/Adminhtml/ModuleFolder/Edit/Tab/Main.php protected $wysiwyg; public function __construct( \Magento\Cms\Model\Wysiwyg\Config $...
Abhishek Panchal's user avatar
5 votes

Magento 2 - How to add wysiwyg editor in frontend PHTML file?

If your Magento version is 2.3.x then use the following code to add wysiwyg editor in frontend PHTML file. Add Textarea: <textarea name="post_content" class="input-text" id="post_content"></...
Sagar Vasani's user avatar
5 votes
Accepted

How to setContent in wysiwyg editor using JQuery in magento2?

Try below code tinyMCE.get('your_textarea_id').setContent("test");
poojan sharma's user avatar
4 votes

Cannot edit widgets in WYSIWYG editor anymore

A quick fix I applied was overriding the tiny_mce JS file with my own patched version. editor.onClick.add(function(editor, e) { e = e.target; - // Workaround for bug, ...
tylersDisplayName's user avatar
4 votes
Accepted

Magento 2: - Set WYSIWYG editor near to custom option in admin side

Please update your StackExchange\Affordablemantel\Plugin\Catalog\Ui\DataProvider\Product\Form\Modifier\CustomOptions.php File with below code <?php namespace StackExchange\Affordablemantel\...
Sunny Rahevar's user avatar
4 votes
Accepted

custom text area wysiwyg attribute product in magento2

Please try like this one: <?php $_product = $block->getProduct(); $demoStore = $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->...
Mohit Kumar Arora's user avatar
4 votes
Accepted

TinyMCE4 <style> tag not showing in editor

TinyMCE disabled the ability to add them outside of the tags, so <style> tags are not valid XHTML, For this you will have to add style tags to the valid children configuration: valid_children :...
Saphal Jha's user avatar
  • 1,883
4 votes
Accepted

Magento 2: add magento widget button on product WYSIWYG editors

Here’s an example on how to do it for the Description field. You can use it for other WYSIWYG fields in the product edit page (just modify the condition for the IF in step number 2 and add the filter ...
Daniel Kratohvil's user avatar
3 votes
Accepted

Editor wysiwyg not resolve url of media directive

Please change this setting and check Store -> Configuration -> General -> Content Management -> Use Static URLs for Media Content in WYSIWYG for Catalog to Yes But, there are some big ...
Abhinav Singh's user avatar
3 votes

Magento 2 WYSIWYG Media image directive using admin url

The simplest solution is to update the getImageHtmlDeclaration() function in vendor/magento/module-cms/Helper//Wysiwyg/images.php public function getImageHtmlDeclaration($filename, $renderAsTag = ...
Overcomer's user avatar
  • 131
3 votes

No WYSIWYG editor in Magento 2

It's a magento bug that you are facing but If you hard refresh that page for two or three times and check the editor It can be work Thank You
jayjit gatha's user avatar
3 votes

Add WYSIWYG Editor to Block Form in Magento 2

It is very simple dont do all this things just put below code in app\code\NameSpace\Module\view\adminhtml\layout\module_module_form.xml <field name="content"> <argument name="...
Parth's user avatar
  • 31
3 votes

Add WYSIWYG Editor to Block Form in Magento 2

@Avesh Naik you can use below code to add the wysiwyg field in UI Form, it will add field with the form width, you will not face the fullwidth issue with field. <field name="front_message2" ...
Vips Lucky's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible