Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Yii2 "paste_preprocess" and "deny images to save in DB" #28

Closed
obladon25 opened this issue Aug 23, 2016 · 1 comment
Closed

Yii2 "paste_preprocess" and "deny images to save in DB" #28

obladon25 opened this issue Aug 23, 2016 · 1 comment
Labels

Comments

@obladon25
Copy link

obladon25 commented Aug 23, 2016

<?= $form->field($model, 'description')->widget(TinyMce::className(), [
    'options' => [
        'id' => 'descript_tinyMce',
        'rows' => 15
    ],
    'language' => 'en_CA', 
    'clientOptions' => [
        'plugins' => [
            "advlist autolink lists link charmap print preview anchor",
            "searchreplace visualblocks code fullscreen",
            "insertdatetime media table contextmenu paste",
            "responsivefilemanager filemanager image",
        ],
        'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent | link responsivefilemanager image",
        'external_filemanager_path' => '/web/js/plugins/responsivefilemanager/filemanager/',
        'filemanager_title' => 'Responsive Filemanager',
        'external_plugins' => [
            'filemanager' => '/web/js/plugins/responsivefilemanager/filemanager/plugin.min.js',
            'responsivefilemanager' => '/web/js/plugins/responsivefilemanager/tinymce/plugins/responsivefilemanager/plugin.min.js',
        ],
        'inline_styles' => false,  
        'convert_fonts_to_spans' => true,
        'element_format' => 'html',
        'invalid_elements' => 'em,font', 
        // 'paste_preprocess' => 'MY FUNCTION ???',
    ]
])->label(false);?>

The plugin works very well.

  1. How can I write "invalid_elements" function to execute,
    or How I can initialize a separate JavaScript file where to write the given function ?

  2. How can I set the pictures copied from Microsoft Word to upload on the server but not in the database?

Sorry my bad english.
Thanks so much for plugin.

@tonydspaniard
Copy link
Member

'paste_preprocess' => new JsExpression('function(plugin, args) {
        console.log(args.content);
        args.content += ' preprocess';
    }'); 

There you go

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants