TinyMCE shows builder font change tags - system-font

After integration, I used to create a template and save the HTML source code. After I view that HTML code it shows the below as in the attached screenshot.
Inside that editor shows like the below-attached screenshot:
Here is my code
var tinyconfig = {
skin: 'oxide-dark',
inline: true,
menubar: false,
force_br_newlines : false,
force_p_newlines : false,
forced_root_block : '',
inline_boundaries: false,
relative_urls: false,
convert_urls: false,
remove_script_host : false,
valid_elements : '*[*],meta[*]',
valid_children: '+h1[div],+h2[div],+h3[div],+h4[div],+h5[div],+h6[div],+a[div]',
plugins: 'image link textcolor lists autolink',
//toolbar: 'undo redo | bold italic underline | fontselect fontsizeselect | forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent',
// toolbar: [
// 'undo redo | bold italic underline | fontselect fontsizeselect | link | menuDateButton',
// 'forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent'
// ],
toolbar:false,
external_filemanager_path:'{{ url('/') }}'.replace('/index.php','')+"/filemanager2/",
filemanager_title:"Responsive Filemanager" ,
external_plugins: { "filemanager" : '{{ url('/') }}'.replace('/index.php','')+"/filemanager2/plugin.min.js"},
setup: function (editor) {
/* Menu button that has a simple "insert date" menu item, and a submenu containing other formats. */
/* Clicking the first menu item or one of the submenu items inserts the date in the selected format. */
editor.ui.registry.addMenuButton('menuDateButton', {
text: getI18n('editor.insert_tag'),
fetch: function (callback) {
var items = [];
thisEditor.tags.forEach(function(tag) {
if ( tag.type == 'label') {
items.push({
type: 'menuitem',
text: tag.tag.replace("{", "").replace("}", ""),
onAction: function (_) {
if (tag.text) {
editor.insertContent(tag.text);
} else {
editor.insertContent(tag.tag);
}
}
});
}
});
callback(items);
}
});
}
};

Related

How to customize editor by data type

I made a table with kendo-grid.This table have two columns.one is item, another is value.
just as
+-----------+-----------+
| item | value |
+-----------+-----------+
| Retry | yes |
| interval | 8 |
+-----------+-----------+
How to customize editor(inline) with value column.if value is [yes], use the dropdownlist editor, if value is [8], use the numeric edior.
Thx.
For your convenience, I prepared a small example demonstrating such customization of kendo-grid.
Here's the example how you can customize the editor option of column based on the value that column contains(for example "yes" in your case):
function DropDownEditor(container, options) {
if(options.model.itemvalue =="yes"){
var input = $('<input required name="' + options.field + '"/>')
input.appendTo(container);
input.kendoDropDownList({
dataSource: {
data: ["yes", "no"]
}
});
}
else{
var input = $('<input type="text" class="k-input k-textbox" name="itemvalue" data-bind="value:itemvalue">');
input.appendTo(container);
}
};
And your grid's configuration may look like:
var grid = $("#grid").kendoGrid({
dataSource: {
data:[{"item":"Retry", "itemvalue":"yes"},{"item":"interval", "itemvalue": 8}]
},
height: 500,
columns: [
{ field: "item", width: "200px"},
{ field: "itemvalue", editor: DropDownEditor }],
editable: "incell"
}).data("kendoGrid");
In above example the column with the editor uses the DropDownEditor function to create the editor based on the value in "itemvalue" column.
Hope this helps.

Responsive filemanager with tinymce in codeigniter not showing thumbnails

I am using Responsive Filemanager with tinyMce 4.6.5 in Codeigniter.
After the page is loaded, if I try to insert an image from the existing ones, the thumbnails are not displayed (example in the picture).
My Responsive Filemanager configuration:
'base_url' => ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && ! in_array(strtolower($_SERVER['HTTPS']), array( 'off', 'no' ))) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'],
'upload_dir' => '/testsite/uploads/tinyMce/thumbs/',
'current_path' => '../../uploads/tinyMce/thumbs/',
'thumbs_base_path' => '../../uploads/tinyMce/thumbs/', //opens in filemanager
And tinyMce configuration:
tinymce.init({
selector: selector,
height: 200,
width: 700,
theme: 'modern',
skin:'lightgray',
plugins: [
'advlist autolink lists charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor textpattern imagetools toc responsivefilemanager'
],
filemanager_title:"Responsive Filemanager",
external_filemanager_path: siteURL + "scripts/filemanager/",
external_plugins: { "filemanager" : siteURL + "scripts/filemanager/plugin.min.js"},
toolbar1: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
toolbar2: 'print preview media | forecolor backcolor emoticons | help',
image_advtab: true,
templates: [
{ title: 'Test template 1', content: 'Test 1' },
{ title: 'Test template 2', content: 'Test 2' }
]
});
If I inspect the image container, this is the html:
<img class=" lazy-loaded" data-original="../../uploads/tinyMce/thumbs/doggo.jpg" src="data:image/png;base64...">
And after pressing the refresh button from Responsive filemanager, it changes to this:
<img class=" lazy-loaded" data-original="../../uploads/tinyMce/thumbs/doggo.jpg" src="../../uploads/tinyMce/thumbs/doggo.jpg" style="display: inline;">
The thumbnail is displayed if I press on 'Preview'.
Thanks in advance :)
try to edit a file from filemanager folder that name is dialog.php
Type search "img" and you will find div with class img-precontainer.
Then you will see "data-src". You must change it to be "src". Hope it works.
here is the link for the code/example https://gist.github.com/cloudsnight/f44103499e9bb5b782efea7e80b4c9a6
here is the link of complete example from me :
https://github.com/cloudsnight/testplugins.git

CKEDITOR - create new button in toolbar

I'm trying to create a new button in CKEDITOR toolbar and do something with it but no way...
I haven't any error in my console and nothing appear in the toolbar...
My code :
var textarea = $('#tiny_mce_block').find('textarea');
var textareaId;
$(document).ready(function () {
textareaId = textarea.attr('id'); // Récupère l'ID du textarea pour être transformé par CKEDITOR
ckeditor_init(); // Initialisation de CKEDITOR
});
/*************************
CKEDITOR
************************/
function ckeditor_init() {
CKEDITOR.replace(textareaId, {
removePlugins: 'autosave, elementspath', //, liststyle, tabletools, contextmenu <= à ajouter pour supprimer click droit
language: 'fr',
entities: false,
entities_latin: false,
contentsCss: [
'/css/ckeditor_audio_transcription_v1.css',
'/plugins/bower_components/ckeditor/contents.css'
],
allowedContent: true,
extraAllowedContent: 'show, word',
disallowedContent: 'script, script; *[on*]',
enterMode: CKEDITOR.ENTER_P,
autoParagraph: false,
ignoreEmptyParagraph: true,
toolbar: [
['Bold', 'Italic', 'Underline', '-', 'TextColor'],
['Undo', 'Redo'],
['Find', 'Replace', 'SelectAll'],
['Maximize']
],
on: {
// Register command and button along with other plugins.
pluginsLoaded: function () {
var editor = this;
// Registers a command that applies the style.
// Note: it automatically adds Advanced Content Filter rules.
this.addCommand("alignementCommand", { // create named command
exec: function (edt) {
alert(edt.getData());
}
});
// Add toolbar button for this command.
this.ui.addButton && this.ui.addButton('alignementBoutton', {
label: 'Alignement',
command: 'alignementCommand',
toolbar: 'insert'
});
}
}
});
}
Where is the problem ?
Thank you !

How to implement button insert image tiny mce

I am developing my own image manager, until now I have reached to open the pop-up and list my images, but after this I have no idea how to get the URL of the image to insert in tiny mce
Here's is my source code:
$(document).ready(function() {
$('#txapublication').tinymce({
toolbar: 'styleselect | bold underline italic | alignleft aligncenter alignright alignjustify | bullist numlist | link image | media | forecolor backcolor',
plugins: [
'advlist image autolink link lists charmap preview',
'searchreplace wordcount code media',
'save textcolor'
],
menubar: false,
language: 'es',
file_browser_callback: function(field_name, url, type, win) {
win.document.getElementById(field_name).value = 'my browser value';
tinymce.activeEditor.windowManager.open({
title: 'Browse Image',
file: "<? echo PUBLIC_PATH ?>" + 'account/selimgsblog',
width: 450,
height: 305,
resizable: "no",
inline: "yes",
close_previous: "no",
buttons: [{
text: 'Insert',
classes: 'widget btn primary first abs-layout-item',
disabled: true,
onclick: 'close'
}, {
text: 'Close',
onclick: 'close',
window: win,
input: field_name
}]
});
}
});
});
Here is my source to list the images, these images come from a method in a controller
<?foreach($imagenes as $img):?>
<img src="<? echo PUBLIC_PATH.$img->path.$img->name?>" width="80" height="80"/>
<?endforeach;?>
I am using tiny mce 4.0.6
You can try:
In buttons.js
(function() {
tinymce.PluginManager.add('my_mce_button', function( editor, url ) {
editor.addButton( 'my_mce_button', {
icon: 'my-mce-icon',
onclick: function() {
editor.insertContent('[shortcode name="" title=""]');
}
});
});
})();
Here need to use buttons as background like this in functions.php:
function my_shortcodes_mce_css() { ?>
<style type="text/css" >
.mce-ico.mce-i-my-mce-icon {
background:url(http://prowpexpert.com/wp-content/uploads/2014/05/favicon-1.ico);
}
</style>
<?php
}
add_action( 'admin_enqueue_scripts', 'my_shortcodes_mce_css' );
You can get help from here about wp tiny mce buttons: http://prowpexpert.com/dynamic-tab-html-wp/

adding custom drop down list in tinymce

I have to display a drop down list in tinymce. I googled to find any tutorial or any good example but I just found that code:
// Adds a menu to the currently active editor instance
var dm = tinyMCE.activeEditor.controlManager.createDropMenu('somemenu');
// Add some menu items
dm.add({title : 'Menu 1', onclick : function() {
alert('Item 1 was clicked.');
}});
dm.add({title : 'Menu 2', onclick : function() {
alert('Item 2 was clicked.');
}});
// Adds a submenu
var sub1 = dm.addMenu({title : 'Menu 3'});
sub1.add({title : 'Menu 1.1', onclick : function() {
alert('Item 1.1 was clicked.');
}});
// Adds a horizontal separator
sub1.addSeparator();
sub1.add({title : 'Menu 1.2', onclick : function() {
alert('Item 1.2 was clicked.');
}});
// Adds a submenu to the submenu
var sub2 = sub1.addMenu({title : 'Menu 1.3'});
// Adds items to the sub sub menu
sub2.add({title : 'Menu 1.3.1', onclick : function() {
alert('Item 1.3.1 was clicked.');
}});
sub2.add({title : 'Menu 1.3.2', onclick : function() {
alert('Item 1.3.2 was clicked.');
}});
dm.add({title : 'Menu 4', onclick : function() {
alert('Item 3 was clicked.');
}});
// Display the menu at position 100, 100
dm.showMenu(100, 100);
This code seems to create a drop down list but I don't know where to put this code or how to use it to display custom drop down list.
Kindly somebody help me in adding custom drop down list in tinyMCE.
var myListItems = ['Item1', 'Item2', 'Item3', 'Item4', 'Item5', 'Item6', 'Item7',
'Item8', 'Item9', 'Item10', 'Item11'];
tinymce.PluginManager.add('mypluginname', function (editor) {
var menuItems = [];
tinymce.each(myListItems, function (myListItemName) {
menuItems.push({
text: myListItemName,
onclick: function () {
editor.insertContent(myListItemName);
}
});
});
editor.addButton('mypluginname', {
type: 'menubutton',
text: 'My Plugin Name',
icon: 'code',
menu: menuItems
});
editor.addMenuItem('mypluginnameDropDownMenu', {
icon: 'code',
text: 'My Plugin Name',
menu: menuItems,
context: 'insert',
prependToContext: true
});
});
Then add to your list of plugin when you initialize your editor:
$('#myTesxtArea').tinymce({
theme: "modern",
convert_urls: false,
height: 100,
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime nonbreaking save table contextmenu directionality",
"paste textcolor","mypluginname"
],
toolbar1: "undo redo | forecolor backcolor | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
image_advtab: true
});
Here's how panel button with dropdown looks like:
First, register the plugin:
var myListItems = ['Item1','Item2'];
tinymce.PluginManager.add('myNewPluginName', function(editor) {
var menuItems = [];
tinymce.each(myListItems, function(myListItemName) {
menuItems.push({
text: myListItemName,
onclick: function() {
editor.insertContent(myListItemName);
}
});
});
editor.addMenuItem('insertValueOfMyNewDropdown', {
icon: 'date',
text: 'Do something with this new dropdown',
menu: menuItems,
context: 'insert'
});
});
Then add to your list of plugin when you initialize your editor:
$('#myTesxtArea').tinymce({
theme: "modern",
convert_urls: false,
height: 100,
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime nonbreaking save table contextmenu directionality",
"myNewPluginName paste textcolor"
],
toolbar1: "undo redo | forecolor backcolor | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
image_advtab: true
});
Here is TinyMCE's documentation for creating a plugin http://www.tinymce.com/wiki.php/TinyMCE3x:Creating_a_plugin. I would start with that just to learn how plugins work. Then to get a better feel for creating a dropdown menu look at the contextmenu plugin. Copy it, and modify it to meet your needs.

Resources