Is this possible with a tinymce plugin? I think other ways to access the iframe are not working or not recommended.
I have found this And tried that in the printing mce plugin inside the TinyMCE Advanced plugin but it does not work.
var $ = tinymce.dom.DomQuery;
$('p').attr('attr', 'value').addClass('class');
I have installed the tinymce advanced plugin and tryed adding this lines to the print plugin. The plugin gets executed, the print dialog opens but it just does not to anything to the dom. Does WP has the full version of tinymce?
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 1999-2015 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
var mce_dom = tinymce.dom.DomQuery;
mce_dom('p').attr('id', 'arve').addClass('arve-html-class');
mce_dom('html').attr('id', 'arve').addClass('arve-html-class');
tinymce.PluginManager.add('print', function(editor) {
var mce_dom = tinymce.dom.DomQuery;
mce_dom('p').attr('id', 'arve').addClass('arve-html-class');
mce_dom('html').attr('id', 'arve').addClass('arve-html-class');
editor.addCommand('mcePrint', function() {
editor.getWin().print();
});
editor.addButton('print', {
title: 'Print',
cmd: 'mcePrint'
});
editor.addShortcut('Meta+P', '', 'mcePrint');
editor.addMenuItem('print', {
text: 'Print',
cmd: 'mcePrint',
icon: 'print',
shortcut: 'Meta+P',
context: 'file'
});
});
id
to the<html>
tag inside aniframe
? Doesn't sound like a good idea. Please explain what you want to accomplish with it. There may be a better way to accomplish that without setting a customid
to the<html>
tag.!important
a lot. I have seen other plugins do that. I know the tinymce body has#tinymce
and I can use that but since i include the exact same css from the frontend in tinymce I could save css.#tinymce
in front of it. I could also create a 2nd css tile and just replace my id with#tinymce
in that but its all seem like a horrible solution. I think adding the same ID I use on the frontend is actually a good idea.