A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged

16

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 = $om->get('Magento\Cms\Model\Template\FilterProvider')->getPageFilter()->filter($content); echo $filterManager;


15

Discovered I was missing the Config setting: /** * @var \Magento\Cms\Model\Wysiwyg\Config */ protected $_wysiwygConfig; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Data\FormFactory $formFactory * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig * @...


11

In "Product Attribute" page, when you choose "text area", go down to "Frontend Properties" and Enable "Enable WYSIWYG"


10

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. Magento 2.0 and 2.1 are affected as well (see: https://github.com/magento/magento2/issues/9518) It seems to be a problem with images in general, here's a ...


9

I finally solved the problem. The cause of the problem is unprocessed shortcodes in the html content, which is the {{ media url="..." }} statement. Before echo this statement, the html content should be process by the processor from helper "cms". Below is the code: $html_content = $content_from_db['content']; $html_content = Mage::helper('cms')->...


8

Interestingly enough the save is not the problem. If you copy your html into the cms page and then hit save you will see in the table cms_page that you have your full html in the database. The problem is that tinymce strips out tags that are not allowed so that the next time you save the page the tags will be gone. You need to extend the ...


8

In order to allow to upload and link pdf file, I modified your config.xml <?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Pdf_WysiwygFiles> <version>1.0.0</version> </Pdf_WysiwygFiles> </modules> <adminhtml> <cms> <browser> <extensions> ...


8

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]); /** * Add attributes to the eav/attribute */ $eavSetup->addAttribute( \Magento\Catalog\Model\Product::ENTITY, 'shop_by_brand', [ ...


8

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 to do that is to write an interceptor. In your custom Magento 2 extension's etc/di.xml file: <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...


8

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 __construct( ... \Zend_Filter_Interface $templateProcessor, ..... ) { .... $this->templateProcessor = $templateProcessor; .... } Then ...


8

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 block. /** * @var \Zend_Filter_Interface */ protected $templateProcessor; public function __construct( ..... \Zend_Filter_Interface $...


7

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 TinyMCE v4.6.4 WYSIWYG editor My below solution adds the menubar, font color, background color, image selector, and code buttons to a "loaded" toolbar 1) Create ...


6

I needed to create /media/wysiwyg and set write permissions. It was not created because magento could not write into /media.


6

ohh i got answer Myself Login to Admin. Go to System > Configuration > Content Management (Under General) > WYSIWYG Options ‘Use Static URLs for Media Content in WYSIWYG for Catalog’ – Select “No”


6

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 jquery and wysiwyg tiny_mce and assign to #description require([ 'jquery', 'mage/adminhtml/wysiwyg/tiny_mce/setup' ], function(jQuery){ ...


5

Theoretically adding the following code to js/mage/adminhtml/wysiwyg/tiny_mce/setup.js may help: valid_children : '+body[li]' if it will do the job you may think about how to do it w/o overriding core JS file.


5

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 : getImageHtmlDeclaration and change : $mediaPath = str_replace(Mage::getBaseUrl('media'), '', $fileurl); by $mediaPath = str_replace(mage::app()->getStore($this->...


5

You should try the Markdown editor module from SchumacherFM, it works great and replaces the default WYSIWYG editor of Magento. See: https://github.com/SchumacherFM/Magento-Markdown


5

I have created one custom module for this and we have specified the our filter to magento by adding the following code in config.xml page <global> <cms> <page> <tempate_filter>[Namespace]_[Module]_Model_Template_Filter</tempate_filter> </page> <block> <...


5

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 $wysiwyg ){ $this->wysiwyg = $wysiwyg; } $fieldset->addField( 'fieldname', 'editor', [ ...


5

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 Javascript file or tag: require([ 'jquery', 'mage/adminhtml/wysiwyg/tiny_mce/setup' ], function(jQuery){ var config = {}, ...


4

You can esily create your own module (depends on Mage_Adminhtml) which is extending that js file: config.xml: <?xml version="1.0"?> <config> <modules> <Your_Module> <version>0.0.1</version> </Your_Module> </modules> <adminhtml> <layout> &...


4

Magento uses the TinyMCE WYSIWYG editor. The problems for IE11 seem to be fixed in version 4.x: http://www.tinymce.com/develop/bugtracker_view.php?id=6307 On how to check to upgrade TinyMCE, check the following question and answers: Update tiny_mce to latest version 4.0.3 (2013-08-08)


4

Here is what worked for me. First of all, the attribute education must have the frontend_input set to editor. If you already have the attribute change the value of the frontend_input column in the eav_attribute table to editor. If you are willing to start from scratch here is a full module that worked for me. Let's call the module StackExchange_Education. ...


4

You need declare this Class in constructor of Block: Magento\Cms\Model\Template\FilterProvider $filterProvider $content = '{{media url="wysiwyg/some_image.jpg"}}'; $contentGenerating = $this->_filterProvider->getPageFilter()->filter($content); echo $contentGenerating; //Generate HTML <img src="http://baseUrl/pub/media/wysiwyg/some_image.jpg"/&...


4

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="1.0" ?> <widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd"&...


4

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 : "+body[style]" So for magento you need to replace the code in lib/web/tiny_mce_4/tinymce.min.js: to : p("+ol[ul|ol],+ul[ul|ol]") with : p("+ol[ul|ol],+...


4

Try below code tinyMCE.get('your_textarea_id').setContent("test");


4

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</label> <frontend_model>Vendor\Module\Block\Adminhtml\System\Config\Form\Field\Editor</frontend_model> </field> Now create below Block ...


3

If you look at the file Mage_Adminhtml_Catalog_ProductController you will see where it add the store url for product wysiwyg. $storeMediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); $content = $this->getLayout()->createBlock('adminhtml/catalog_helper_form_wysiwyg_content', '', array( '...


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