{"id":22841245,"url":"https://github.com/dominus77/yii2-tinymce-widget","last_synced_at":"2025-04-28T11:15:26.951Z","repository":{"id":56971024,"uuid":"82848947","full_name":"Dominus77/yii2-tinymce-widget","owner":"Dominus77","description":"TinyMCE 4  widget for Yii2.","archived":false,"fork":false,"pushed_at":"2021-01-11T14:54:45.000Z","size":578,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T11:15:18.661Z","etag":null,"topics":["dominus77","elfinder","tinymce","widget","yii2","yii2-tinymce-widget"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dominus77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"dominus77"}},"created_at":"2017-02-22T20:24:31.000Z","updated_at":"2023-07-29T22:00:35.000Z","dependencies_parsed_at":"2022-08-21T11:20:15.708Z","dependency_job_id":null,"html_url":"https://github.com/Dominus77/yii2-tinymce-widget","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dominus77%2Fyii2-tinymce-widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dominus77%2Fyii2-tinymce-widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dominus77%2Fyii2-tinymce-widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dominus77%2Fyii2-tinymce-widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dominus77","download_url":"https://codeload.github.com/Dominus77/yii2-tinymce-widget/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251302782,"owners_count":21567601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dominus77","elfinder","tinymce","widget","yii2","yii2-tinymce-widget"],"created_at":"2024-12-13T01:15:26.300Z","updated_at":"2025-04-28T11:15:26.930Z","avatar_url":"https://github.com/Dominus77.png","language":"PHP","funding_links":["https://patreon.com/dominus77"],"categories":[],"sub_categories":[],"readme":"# TinyMCE 4  widget for Yii2\n\n[![Latest Stable Version](https://poser.pugx.org/dominus77/yii2-tinymce-widget/v/stable)](https://packagist.org/packages/dominus77/yii2-tinymce-widget)\n[![License](https://poser.pugx.org/dominus77/yii2-tinymce-widget/license)](https://github.com/Dominus77/yii2-tinymce-widget/blob/master/LICENSE.md)\n[![Total Downloads](https://poser.pugx.org/dominus77/yii2-tinymce-widget/downloads)](https://packagist.org/packages/dominus77/yii2-tinymce-widget)\n\nRenders a [TinyMCE WYSIWYG text editor](https://www.tinymce.com) widget with the support [ElFinder Extension for Yii 2](https://github.com/MihailDev/yii2-elfinder)\n\n## Supplements\nA plugin [TinyMCE-FontAwesome-Plugin](https://github.com/josh18/TinyMCE-FontAwesome-Plugin/tree/master) that lets you insert FontAwesome icons via TinyMCE.\n\nA plugin [Typografy](https://github.com/Dominus77/typograf) that lets implement [JavaScript typographer](https://github.com/typograf/typograf) in TinyMCE.\n\n## Installation\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\ncomposer require dominus77/yii2-tinymce-widget\n```\n\nor add\n\n```\n\"dominus77/yii2-tinymce-widget\": \"^2.1\"\n```\n\nto the require section of your `composer.json` file.\n\n## Usage\n\nOnce the extension is installed, simply use it in your code by  :\n\n```php\n\u003c?= $form-\u003efield($model, 'text')-\u003ewidget(\\dominus77\\tinymce\\TinyMce::class, [    \n    'options' =\u003e [\n        'rows' =\u003e 6,\n        'placeholder' =\u003e true,\n    ], \n    'language' =\u003e 'ru',\n    'clientOptions' =\u003e [\n        'menubar' =\u003e true,\n        'statusbar' =\u003e true,        \n        'theme' =\u003e 'modern',\n        'skin' =\u003e 'lightgray-gradient', //charcoal, tundora, lightgray-gradient, lightgray\n        'plugins' =\u003e [\n            'typograf advlist autolink lists link image charmap print preview hr anchor pagebreak placeholder',\n            'searchreplace wordcount visualblocks visualchars code fullscreen',\n            'insertdatetime media nonbreaking save table contextmenu directionality',\n            'emoticons template paste textcolor colorpicker textpattern imagetools codesample toc noneditable',\n        ],\n        'contextmenu' =\u003e 'typograf | link image inserttable | cell row column deletetable',\n        'noneditable_noneditable_class' =\u003e 'fa',\n        'extended_valid_elements' =\u003e 'span[class|style]',\n        'toolbar1' =\u003e 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',\n        'toolbar2' =\u003e 'print preview media | forecolor backcolor emoticons | codesample | typograf',\n        'image_advtab' =\u003e true,\n        'templates' =\u003e [\n            [\n                'title' =\u003e 'Test template 1',\n                'content' =\u003e 'Test 1',\n            ],\n            [\n                'title' =\u003e 'Test template 2',\n                'content' =\u003e 'Test 2',\n            ]\n        ],\n        'content_css' =\u003e [\n            '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',\n            '//www.tinymce.com/css/codepen.min.css',            \n        ]\n    ]\n]) ?\u003e\n\n```\n## Plugin Typograf\nHelps to automatically fill in inextricable spaces, correct minor typos,\nbring quotation marks to the correct form, replace hyphens with dashes in the right places, and much more.\n```php\n\u003c?= $form-\u003efield($model, 'text')-\u003ewidget(\\dominus77\\tinymce\\TinyMce::class, [\n    //...\n    'clientOptions' =\u003e [\n        // on plugin\n        'plugins' =\u003e [\n            'typograf',\n            //...\n        ],\n        // adding a button to a toolbar\n        'toolbar1' =\u003e 'typograf',\n        // adding a item to a context menu\n        'contextmenu' =\u003e 'typograf | link image inserttable | cell row column deletetable',\n        // advanced plugin settings        \n        'typograf' =\u003e [\n            'locale' =\u003e ['ru', 'en-US'],\n            // HTML entities\n            'htmlEntity' =\u003e [\n                //'type' =\u003e 'name',\n                //'onlyInvisible' =\u003e true\n            ],\n            // Enabling Rules\n            'enableRule' =\u003e [\n                //'ru/money/ruble',\n                //'ru/money/*',\n                //'ru/symbols/NN',\n                //'ru/optalign/*'\n            ],\n            // Disabling Rules\n            'disableRule' =\u003e [\n                //'ru/money/ruble',\n                //'ru/money/*',\n                //'ru/symbols/NN'\n            ],\n            // Change settings for rules\n            // Rule name, setting name, value\n            'setSetting' =\u003e [\n                // Continuous space before the last word in a sentence, not more than 5 characters\n                ['common/nbsp/beforeShortLastWord', 'lengthLastWord', 5],\n                // Nested quotes are also \"Christmas trees\" for Russian typography\n                ['common/punctuation/quote', 'ru', ['left' =\u003e '«', 'right' =\u003e '»', 'removeDuplicateQuotes' =\u003e true]],\n                // Non-breaking space after a short word, no more than 3 characters\n                ['common/nbsp/afterShortWord', 'lengthShortWord', 5]\n            ],\n            // Add a simple rule\n            // Typographic Smiley\n            'addRule' =\u003e [\n                [\n                    'name' =\u003e 'common/other/typographicSmiley',\n                    'handler' =\u003e new yii\\web\\JsExpression(\"\n                        function (text) {                                            \n                            return text.replace(/:-\\)/g, ':—)');\n                        }\n                    \")\n                ]\n            ],\n            // Turn off typography in sections of text\n            'addSafeTag' =\u003e [\n                // Disable typography inside the \u003cno-typography\u003e tag\n                ['\u003cno-typography\u003e', '\u003c/no-typography\u003e'],\n                // Disable typing inside control structures of some template engine.\n                ['\\\\{\\\\{', '\\\\}\\\\}'], // {{...}}\n                ['\\\\[\\\\[', '\\\\]\\\\]'], // [[...]]\n                // Disable typography inside PHP code\n                ['\u003c\\\\?php', '\\\\?\u003e']\n            ]\n        ],\n        //...\n    ]\n]) ?\u003e\n```\n\nSee more information on [JavaScript typographer](https://github.com/typograf/typograf)\n\n## Plugin fontawesome\n\nThe plugin is supported by FontAwesome version 4.7. \nIn this version of the widget, due to possible conflicts with the new version, the dependency was removed.\nBut the support of the plug-in itself remained. To turn it on, you need to install FontAwesome version 4.7\n\n```\ncomposer require fortawesome/font-awesome \"^4.7\"\n```\nor add\n\n```\n\"fortawesome/font-awesome\": \"^4.7\"\n```\nThe connection might look like this:\n\n```php\nuse dominus77\\tinymce\\assets\\FontAwesomeAsset;\n\n$fontAwesome = FontAwesomeAsset::register($this);\n\n````\n\n```php\n//...\n'clientOptions' =\u003e [\n    //...\n    'plugins' =\u003e [            \n        \"fontawesome\", // add plugin\n        // other plugins\n    ],        \n    'toolbar' =\u003e \"fontawesome\", // add button\n    //...\n    'content_css' =\u003e [\n        // other css\n        $fontAwesome-\u003ebaseUrl . '/' . $fontAwesome-\u003ecss[0], // Adding icons to the content area\n    ]\n]\n\n```\n\n## ElFinder file manager\n\nInstall [mihaildev/yii2-elfinder](https://github.com/MihailDev/yii2-elfinder) extension.\n\nEither run\n\n```\ncomposer require --prefer-dist mihaildev/yii2-elfinder \"^1.3\"\n```\n\nor add\n\n```\n\"mihaildev/yii2-elfinder\": \"^1.3\"\n```\n\nConfigure elFinder (more info [here](https://github.com/MihailDev/yii2-elfinder))\n\n```php\n'controllerMap' =\u003e [\n    'elfinder' =\u003e [\n        'class' =\u003e 'mihaildev\\elfinder\\Controller',\n        'access' =\u003e ['@'], //Global file manager access @ - for authorized , ? - for guests , to open to all ['@', '?']\n        'disabledCommands' =\u003e ['netmount'], //disabling unnecessary commands https://github.com/Studio-42/elFinder/wiki/Client-configuration-options#commands\n        'roots' =\u003e [\n            [\n                'baseUrl'=\u003e'@web',\n                'basePath'=\u003e'@webroot',\n                'path' =\u003e 'files/global',\n                'name' =\u003e 'Global'\n            ],\n            [\n                'class' =\u003e 'mihaildev\\elfinder\\volume\\UserPath',\n                'path'  =\u003e 'files/user_{id}',\n                'name'  =\u003e 'My Documents'\n            ],\n            [\n                'path' =\u003e 'files/some',\n                'name' =\u003e ['category' =\u003e 'my','message' =\u003e 'Some Name'] //перевод Yii::t($category, $message)\n            ],\n            [\n                'path'   =\u003e 'files/some',\n                'name'   =\u003e ['category' =\u003e 'my','message' =\u003e 'Some Name'], // Yii::t($category, $message)\n                'access' =\u003e ['read' =\u003e '*', 'write' =\u003e 'UserFilesAccess']  // * - for all, otherwise the access check in this example can be seen by all users with rights only UserFilesAccess\n            ]\n        ],\n        'watermark' =\u003e [\n             'source'         =\u003e __DIR__.'/logo.png', // Path to Water mark image\n             'marginRight'    =\u003e 5,          // Margin right pixel\n             'marginBottom'   =\u003e 5,          // Margin bottom pixel\n             'quality'        =\u003e 95,         // JPEG image save quality\n             'transparency'   =\u003e 70,         // Water mark image transparency ( other than PNG )\n             'targetType'     =\u003e IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )\n             'targetMinPixel' =\u003e 200         // Target image minimum pixel size\n        ]\n    ]\n]\n```\n\nThen select file manager provider in the widget:\n\n```php\n$form-\u003efield($model, 'text')-\u003ewidget(\\dominus77\\tinymce\\TinyMce::class, [    \n    'clientOptions' =\u003e [\n        //...\n        /** @see https://www.tinymce.com/docs/configure/file-image-upload/#file_picker_types */\n        //'file_picker_types' =\u003e 'file image media',        \n    ],\n    'fileManager' =\u003e [\n        'class' =\u003e \\dominus77\\tinymce\\components\\MihaildevElFinder::class,\n    ],    \n    //...\n])\n```\n\nYou can customize some window (width and height) and manager (language, filter, path and multiple) properties. If you want to use different access, watermark and roots setting just prepare controllers:\n\n```php\n'controllerMap' =\u003e [\n    'elf1' =\u003e [\n        'class' =\u003e 'mihaildev\\elfinder\\Controller',\n        'access' =\u003e ['@'],\n        'roots' =\u003e [\n            [\n                'baseUrl'=\u003e'@web',\n                'basePath'=\u003e'@webroot',\n                'path' =\u003e 'files/global',\n                'name' =\u003e 'Global'\n            ],\n        ],\n        'watermark' =\u003e [\n            'source'         =\u003e __DIR__.'/logo.png', // Path to Water mark image\n            'marginRight'    =\u003e 5,          // Margin right pixel\n            'marginBottom'   =\u003e 5,          // Margin bottom pixel\n            'quality'        =\u003e 95,         // JPEG image save quality\n            'transparency'   =\u003e 70,         // Water mark image transparency ( other than PNG )\n            'targetType'     =\u003e IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )\n            'targetMinPixel' =\u003e 200         // Target image minimum pixel size            \n        ],\n    ],\n    'elf2' =\u003e [\n        'class' =\u003e 'mihaildev\\elfinder\\Controller',\n        'access' =\u003e ['*'],\n        'roots' =\u003e [\n            [                \n                'path' =\u003e 'files/some1',\n                'name' =\u003e ['category' =\u003e 'my','message' =\u003e 'Some Name']\n            ],\n            [                \n                'path' =\u003e 'files/some2',\n                'name' =\u003e ['category' =\u003e 'my','message' =\u003e 'Some Name'],\n                'access' =\u003e ['read' =\u003e '*', 'write' =\u003e 'UserFilesAccess']\n            ],\n        ],\n    ],\n]\n```\n\nConnection in the module:\n\n```php\nnamespace modules\\example;\n\nclass Module extends \\yii\\base\\Module\n{\n    //...\n    public function init()\n    {\n        parent::init();\n        $this-\u003econtrollerMap = [\n            'elfinder' =\u003e [\n                'class' =\u003e 'mihaildev\\elfinder\\Controller',\n                'access' =\u003e ['@'],\n                'disabledCommands' =\u003e ['netmount'],\n                'roots' =\u003e [\n                    [\n                        'baseUrl'=\u003e'@web',\n                        'basePath'=\u003e'@webroot',\n                        'path' =\u003e 'files/global',\n                        'name' =\u003e 'Global'\n                    ],\n                ],\n                'watermark' =\u003e [\n                    'source'         =\u003e __DIR__.'/logo.png', // Path to Water mark image\n                    'marginRight'    =\u003e 5,          // Margin right pixel\n                    'marginBottom'   =\u003e 5,          // Margin bottom pixel\n                    'quality'        =\u003e 95,         // JPEG image save quality\n                    'transparency'   =\u003e 70,         // Water mark image transparency ( other than PNG )\n                    'targetType'     =\u003e IMG_GIF|IMG_JPG|IMG_PNG|IMG_WBMP, // Target image formats ( bit-field )\n                    'targetMinPixel' =\u003e 200         // Target image minimum pixel size            \n                ],\n            ]\n        ];\n    }\n    //...\n}\n```\n\nin module view:\n\n```php\n$form-\u003efield($model, 'text')-\u003ewidget(\\dominus77\\tinymce\\TinyMce::class, [    \n    'clientOptions' =\u003e [\n        //...\n        /** @see https://www.tinymce.com/docs/configure/file-image-upload/#file_picker_types */\n        //'file_picker_types' =\u003e 'file image media',\n    ],\n    'fileManager' =\u003e [\n        'class' =\u003e \\dominus77\\tinymce\\components\\MihaildevElFinder::class,\n        'controller' =\u003e 'elfinder',        \n        'title' =\u003e 'My File Manager',\n        'width' =\u003e 900,\n        'height' =\u003e 600,\n        'resizable' =\u003e 'yes',\n    ],    \n    //...\n]);\n```\n\n## Further Information\nPlease, check the [TinyMCE site](https://www.tinymce.com/docs/configure/) and [ElFinder Extension](https://github.com/MihailDev/yii2-elfinder) documentation for further information about its configuration options.\n\n## License\nThe MIT License (MIT). Please see [License File](https://github.com/Dominus77/yii2-tinymce-widget/blob/master/LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominus77%2Fyii2-tinymce-widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdominus77%2Fyii2-tinymce-widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominus77%2Fyii2-tinymce-widget/lists"}