public function loadAssets() { $editor = Settings::instance()->editor; if ($editor == 'tinymce') { $this->addJs('tinymce/tinymce.min.js'); } if ($editor == 'ckeditor') { $this->addJs('ckeditor/ckeditor.js'); $this->addJs('ckeditor/adapters/jquery.js'); } if ($editor == 'froala') { $this->addCss('froala/css/font-awesome.min.css'); $this->addCss('froala/css/froala_editor.min.css'); $this->addJs('froala/js/froala_editor.min.js'); $this->addJs('froala/js/plugins/video.min.js'); $this->addJs('froala/js/plugins/block_styles.min.js'); $this->addJs('froala/js/plugins/colors.min.js'); $this->addJs('froala/js/plugins/char_counter.min.js'); $this->addJs('froala/js/plugins/font_family.min.js'); $this->addJs('froala/js/plugins/font_size.min.js'); $this->addJs('froala/js/plugins/lists.min.js'); $this->addJs('froala/js/plugins/tables.min.js'); } }
public function loadAssets() { $editor = Settings::instance()->editor; $locale = App::getLocale(); if ($editor == 'tinymce') { $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/tinymce/tinymce.min.js'); if ($locale != 'en' && File::exists('plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/tinymce/langs/' . $locale . '.js')) { $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/tinymce/langs/' . $locale . '.js'); } } else { if ($editor == 'ckeditor') { $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/ckeditor/ckeditor.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/ckeditor/adapters/jquery.js'); if ($locale != 'en' && File::exists('plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/ckeditor/lang/' . $locale . '.js')) { $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/ckeditor/lang/' . $locale . '.js'); } } else { if ($editor == 'froala') { $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/font-awesome.min.css'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/froala_editor.min.css'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/froala_style.min.css'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/themes/october.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/froala_editor.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/align.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/char_counter.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/char_counter.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/code_beautifier.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/code_view.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/code_view.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/colors.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/colors.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/draggable.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/draggable.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/emoticons.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/emoticons.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/entities.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/file.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/file.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/font_family.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/font_size.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/fullscreen.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/fullscreen.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/image.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/image.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/image_manager.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/image_manager.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/inline_style.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/line_breaker.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/line_breaker.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/link.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/lists.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/paragraph_format.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/paragraph_style.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/quick_insert.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/quick_insert.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/quote.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/save.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/table.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/table.min.js'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/url.min.js'); $this->addCss('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/css/plugins/video.min.css'); $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/plugins/video.min.js'); if ($locale != 'en' && File::exists('plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/languages/' . $locale . '.js')) { $this->addJs('/plugins/anandpatel/wysiwygeditors/formwidgets/editor/assets/froala/js/languages/' . $locale . '.js'); } } } } }
function useWysiwyg($form) { $replacable = ['codeeditor', 'Eein\\Wysiwyg\\FormWidgets\\Trumbowyg', 'richeditor', 'RainLab\\Blog\\FormWidgets\\BlogMarkdown']; foreach ($form->getFields() as $field) { if (!empty($field->config['type'])) { if (in_array($field->config['type'], $replacable)) { if (Settings::instance()->editor == 'richeditor') { $field->config['type'] = $field->config['widget'] = 'richeditor'; } else { $field->config['type'] = $field->config['widget'] = 'AnandPatel\\WysiwygEditors\\FormWidgets\\Editor'; } return; } } } }
function useWysiwyg($form) { foreach ($form->getFields() as $field) { if (!empty($field->config['type'])) { if ($field->config['type'] == 'codeeditor' || $field->config['type'] == 'Eein\\Wysiwyg\\FormWidgets\\Trumbowyg' || $field->config['type'] == 'richeditor') { if (Settings::instance()->editor == 'richeditor') { $field->config['type'] = $field->config['widget'] = 'richeditor'; } else { $field->config['type'] = $field->config['widget'] = 'AnandPatel\\WysiwygEditors\\FormWidgets\\Editor'; } return; } } } }