mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 12:01:23 +01:00
natural search in list pages
This commit is contained in:
@@ -1,234 +1,234 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
var doc = CKEDITOR.document;
|
||||
|
||||
CKEDITOR.dialog.add( 'templates', function( editor )
|
||||
{
|
||||
// Constructs the HTML view of the specified templates data.
|
||||
function renderTemplatesList( container, templatesDefinitions )
|
||||
{
|
||||
// clear loading wait text.
|
||||
container.setHtml( '' );
|
||||
|
||||
for ( var i = 0, totalDefs = templatesDefinitions.length ; i < totalDefs ; i++ )
|
||||
{
|
||||
var definition = CKEDITOR.getTemplates( templatesDefinitions[ i ] ),
|
||||
imagesPath = definition.imagesPath,
|
||||
templates = definition.templates,
|
||||
count = templates.length;
|
||||
|
||||
for ( var j = 0 ; j < count ; j++ )
|
||||
{
|
||||
var template = templates[ j ],
|
||||
item = createTemplateItem( template, imagesPath );
|
||||
item.setAttribute( 'aria-posinset', j + 1 );
|
||||
item.setAttribute( 'aria-setsize', count );
|
||||
container.append( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createTemplateItem( template, imagesPath )
|
||||
{
|
||||
var item = CKEDITOR.dom.element.createFromHtml(
|
||||
'<a href="javascript:void(0)" tabIndex="-1" role="option" >' +
|
||||
'<div class="cke_tpl_item"></div>' +
|
||||
'</a>' );
|
||||
|
||||
// Build the inner HTML of our new item DIV.
|
||||
var html = '<table style="width:350px;" class="cke_tpl_preview" role="presentation"><tr>';
|
||||
|
||||
if ( template.image && imagesPath )
|
||||
html += '<td class="cke_tpl_preview_img"><img src="' + CKEDITOR.getUrl( imagesPath + template.image ) + '"' + ( CKEDITOR.env.ie6Compat ? ' onload="this.width=this.width"' : '' ) + ' alt="" title=""></td>';
|
||||
|
||||
html += '<td style="white-space:normal;"><span class="cke_tpl_title">' + template.title + '</span><br/>';
|
||||
|
||||
if ( template.description )
|
||||
html += '<span>' + template.description + '</span>';
|
||||
|
||||
html += '</td></tr></table>';
|
||||
|
||||
item.getFirst().setHtml( html );
|
||||
|
||||
item.on( 'click', function() { insertTemplate( template.html ); } );
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert the specified template content into editor.
|
||||
* @param {Number} index
|
||||
*/
|
||||
function insertTemplate( html )
|
||||
{
|
||||
var dialog = CKEDITOR.dialog.getCurrent(),
|
||||
isInsert = dialog.getValueOf( 'selectTpl', 'chkInsertOpt' );
|
||||
|
||||
if ( isInsert )
|
||||
{
|
||||
// Everything should happen after the document is loaded (#4073).
|
||||
editor.on( 'contentDom', function( evt )
|
||||
{
|
||||
evt.removeListener();
|
||||
dialog.hide();
|
||||
|
||||
// Place the cursor at the first editable place.
|
||||
var range = new CKEDITOR.dom.range( editor.document );
|
||||
range.moveToElementEditStart( editor.document.getBody() );
|
||||
range.select( 1 );
|
||||
setTimeout( function()
|
||||
{
|
||||
editor.fire( 'saveSnapshot' );
|
||||
}, 0 );
|
||||
});
|
||||
|
||||
editor.fire( 'saveSnapshot' );
|
||||
editor.setData( html );
|
||||
}
|
||||
else
|
||||
{
|
||||
editor.insertHtml( html );
|
||||
dialog.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function keyNavigation( evt )
|
||||
{
|
||||
var target = evt.data.getTarget(),
|
||||
onList = listContainer.equals( target );
|
||||
|
||||
// Keyboard navigation for template list.
|
||||
if ( onList || listContainer.contains( target ) )
|
||||
{
|
||||
var keystroke = evt.data.getKeystroke(),
|
||||
items = listContainer.getElementsByTag( 'a' ),
|
||||
focusItem;
|
||||
|
||||
if ( items )
|
||||
{
|
||||
// Focus not yet onto list items?
|
||||
if ( onList )
|
||||
focusItem = items.getItem( 0 );
|
||||
else
|
||||
{
|
||||
switch ( keystroke )
|
||||
{
|
||||
case 40 : // ARROW-DOWN
|
||||
focusItem = target.getNext();
|
||||
break;
|
||||
|
||||
case 38 : // ARROW-UP
|
||||
focusItem = target.getPrevious();
|
||||
break;
|
||||
|
||||
case 13 : // ENTER
|
||||
case 32 : // SPACE
|
||||
target.fire( 'click' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( focusItem )
|
||||
{
|
||||
focusItem.focus();
|
||||
evt.data.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load skin at first.
|
||||
CKEDITOR.skins.load( editor, 'templates' );
|
||||
|
||||
var listContainer;
|
||||
|
||||
var templateListLabelId = 'cke_tpl_list_label_' + CKEDITOR.tools.getNextNumber(),
|
||||
lang = editor.lang.templates,
|
||||
config = editor.config;
|
||||
return {
|
||||
title :editor.lang.templates.title,
|
||||
|
||||
minWidth : CKEDITOR.env.ie ? 440 : 400,
|
||||
minHeight : 340,
|
||||
|
||||
contents :
|
||||
[
|
||||
{
|
||||
id :'selectTpl',
|
||||
label : lang.title,
|
||||
elements :
|
||||
[
|
||||
{
|
||||
type : 'vbox',
|
||||
padding : 5,
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'selectTplText',
|
||||
type : 'html',
|
||||
html :
|
||||
'<span>' +
|
||||
lang.selectPromptMsg +
|
||||
'</span>'
|
||||
},
|
||||
{
|
||||
id : 'templatesList',
|
||||
type : 'html',
|
||||
focus: true,
|
||||
html :
|
||||
'<div class="cke_tpl_list" tabIndex="-1" role="listbox" aria-labelledby="' + templateListLabelId+ '">' +
|
||||
'<div class="cke_tpl_loading"><span></span></div>' +
|
||||
'</div>' +
|
||||
'<span class="cke_voice_label" id="' + templateListLabelId + '">' + lang.options+ '</span>'
|
||||
},
|
||||
{
|
||||
id : 'chkInsertOpt',
|
||||
type : 'checkbox',
|
||||
label : lang.insertOption,
|
||||
'default' : config.templates_replaceContent
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
buttons : [ CKEDITOR.dialog.cancelButton ],
|
||||
|
||||
onShow : function()
|
||||
{
|
||||
var templatesListField = this.getContentElement( 'selectTpl' , 'templatesList' );
|
||||
listContainer = templatesListField.getElement();
|
||||
|
||||
CKEDITOR.loadTemplates( config.templates_files, function()
|
||||
{
|
||||
var templates = ( config.templates || 'default' ).split( ',' );
|
||||
|
||||
if ( templates.length )
|
||||
{
|
||||
renderTemplatesList( listContainer, templates );
|
||||
templatesListField.focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
listContainer.setHtml(
|
||||
'<div class="cke_tpl_empty">' +
|
||||
'<span>' + lang.emptyListMsg + '</span>' +
|
||||
'</div>' );
|
||||
}
|
||||
});
|
||||
|
||||
this._.element.on( 'keydown', keyNavigation );
|
||||
},
|
||||
|
||||
onHide : function()
|
||||
{
|
||||
this._.element.removeListener( 'keydown', keyNavigation );
|
||||
}
|
||||
};
|
||||
});
|
||||
})();
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
var doc = CKEDITOR.document;
|
||||
|
||||
CKEDITOR.dialog.add( 'templates', function( editor )
|
||||
{
|
||||
// Constructs the HTML view of the specified templates data.
|
||||
function renderTemplatesList( container, templatesDefinitions )
|
||||
{
|
||||
// clear loading wait text.
|
||||
container.setHtml( '' );
|
||||
|
||||
for ( var i = 0, totalDefs = templatesDefinitions.length ; i < totalDefs ; i++ )
|
||||
{
|
||||
var definition = CKEDITOR.getTemplates( templatesDefinitions[ i ] ),
|
||||
imagesPath = definition.imagesPath,
|
||||
templates = definition.templates,
|
||||
count = templates.length;
|
||||
|
||||
for ( var j = 0 ; j < count ; j++ )
|
||||
{
|
||||
var template = templates[ j ],
|
||||
item = createTemplateItem( template, imagesPath );
|
||||
item.setAttribute( 'aria-posinset', j + 1 );
|
||||
item.setAttribute( 'aria-setsize', count );
|
||||
container.append( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createTemplateItem( template, imagesPath )
|
||||
{
|
||||
var item = CKEDITOR.dom.element.createFromHtml(
|
||||
'<a href="javascript:void(0)" tabIndex="-1" role="option" >' +
|
||||
'<div class="cke_tpl_item"></div>' +
|
||||
'</a>' );
|
||||
|
||||
// Build the inner HTML of our new item DIV.
|
||||
var html = '<table style="width:350px;" class="cke_tpl_preview" role="presentation"><tr>';
|
||||
|
||||
if ( template.image && imagesPath )
|
||||
html += '<td class="cke_tpl_preview_img"><img src="' + CKEDITOR.getUrl( imagesPath + template.image ) + '"' + ( CKEDITOR.env.ie6Compat ? ' onload="this.width=this.width"' : '' ) + ' alt="" title=""></td>';
|
||||
|
||||
html += '<td style="white-space:normal;"><span class="cke_tpl_title">' + template.title + '</span><br/>';
|
||||
|
||||
if ( template.description )
|
||||
html += '<span>' + template.description + '</span>';
|
||||
|
||||
html += '</td></tr></table>';
|
||||
|
||||
item.getFirst().setHtml( html );
|
||||
|
||||
item.on( 'click', function() { insertTemplate( template.html ); } );
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert the specified template content into editor.
|
||||
* @param {Number} index
|
||||
*/
|
||||
function insertTemplate( html )
|
||||
{
|
||||
var dialog = CKEDITOR.dialog.getCurrent(),
|
||||
isInsert = dialog.getValueOf( 'selectTpl', 'chkInsertOpt' );
|
||||
|
||||
if ( isInsert )
|
||||
{
|
||||
// Everything should happen after the document is loaded (#4073).
|
||||
editor.on( 'contentDom', function( evt )
|
||||
{
|
||||
evt.removeListener();
|
||||
dialog.hide();
|
||||
|
||||
// Place the cursor at the first editable place.
|
||||
var range = new CKEDITOR.dom.range( editor.document );
|
||||
range.moveToElementEditStart( editor.document.getBody() );
|
||||
range.select( 1 );
|
||||
setTimeout( function()
|
||||
{
|
||||
editor.fire( 'saveSnapshot' );
|
||||
}, 0 );
|
||||
});
|
||||
|
||||
editor.fire( 'saveSnapshot' );
|
||||
editor.setData( html );
|
||||
}
|
||||
else
|
||||
{
|
||||
editor.insertHtml( html );
|
||||
dialog.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function keyNavigation( evt )
|
||||
{
|
||||
var target = evt.data.getTarget(),
|
||||
onList = listContainer.equals( target );
|
||||
|
||||
// Keyboard navigation for template list.
|
||||
if ( onList || listContainer.contains( target ) )
|
||||
{
|
||||
var keystroke = evt.data.getKeystroke(),
|
||||
items = listContainer.getElementsByTag( 'a' ),
|
||||
focusItem;
|
||||
|
||||
if ( items )
|
||||
{
|
||||
// Focus not yet onto list items?
|
||||
if ( onList )
|
||||
focusItem = items.getItem( 0 );
|
||||
else
|
||||
{
|
||||
switch ( keystroke )
|
||||
{
|
||||
case 40 : // ARROW-DOWN
|
||||
focusItem = target.getNext();
|
||||
break;
|
||||
|
||||
case 38 : // ARROW-UP
|
||||
focusItem = target.getPrevious();
|
||||
break;
|
||||
|
||||
case 13 : // ENTER
|
||||
case 32 : // SPACE
|
||||
target.fire( 'click' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( focusItem )
|
||||
{
|
||||
focusItem.focus();
|
||||
evt.data.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load skin at first.
|
||||
CKEDITOR.skins.load( editor, 'templates' );
|
||||
|
||||
var listContainer;
|
||||
|
||||
var templateListLabelId = 'cke_tpl_list_label_' + CKEDITOR.tools.getNextNumber(),
|
||||
lang = editor.lang.templates,
|
||||
config = editor.config;
|
||||
return {
|
||||
title :editor.lang.templates.title,
|
||||
|
||||
minWidth : CKEDITOR.env.ie ? 440 : 400,
|
||||
minHeight : 340,
|
||||
|
||||
contents :
|
||||
[
|
||||
{
|
||||
id :'selectTpl',
|
||||
label : lang.title,
|
||||
elements :
|
||||
[
|
||||
{
|
||||
type : 'vbox',
|
||||
padding : 5,
|
||||
children :
|
||||
[
|
||||
{
|
||||
id : 'selectTplText',
|
||||
type : 'html',
|
||||
html :
|
||||
'<span>' +
|
||||
lang.selectPromptMsg +
|
||||
'</span>'
|
||||
},
|
||||
{
|
||||
id : 'templatesList',
|
||||
type : 'html',
|
||||
focus: true,
|
||||
html :
|
||||
'<div class="cke_tpl_list" tabIndex="-1" role="listbox" aria-labelledby="' + templateListLabelId+ '">' +
|
||||
'<div class="cke_tpl_loading"><span></span></div>' +
|
||||
'</div>' +
|
||||
'<span class="cke_voice_label" id="' + templateListLabelId + '">' + lang.options+ '</span>'
|
||||
},
|
||||
{
|
||||
id : 'chkInsertOpt',
|
||||
type : 'checkbox',
|
||||
label : lang.insertOption,
|
||||
'default' : config.templates_replaceContent
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
buttons : [ CKEDITOR.dialog.cancelButton ],
|
||||
|
||||
onShow : function()
|
||||
{
|
||||
var templatesListField = this.getContentElement( 'selectTpl' , 'templatesList' );
|
||||
listContainer = templatesListField.getElement();
|
||||
|
||||
CKEDITOR.loadTemplates( config.templates_files, function()
|
||||
{
|
||||
var templates = ( config.templates || 'default' ).split( ',' );
|
||||
|
||||
if ( templates.length )
|
||||
{
|
||||
renderTemplatesList( listContainer, templates );
|
||||
templatesListField.focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
listContainer.setHtml(
|
||||
'<div class="cke_tpl_empty">' +
|
||||
'<span>' + lang.emptyListMsg + '</span>' +
|
||||
'</div>' );
|
||||
}
|
||||
});
|
||||
|
||||
this._.element.on( 'keydown', keyNavigation );
|
||||
},
|
||||
|
||||
onHide : function()
|
||||
{
|
||||
this._.element.removeListener( 'keydown', keyNavigation );
|
||||
}
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
CKEDITOR.plugins.add( 'templates',
|
||||
{
|
||||
requires : [ 'dialog' ],
|
||||
|
||||
init : function( editor )
|
||||
{
|
||||
CKEDITOR.dialog.add( 'templates', CKEDITOR.getUrl( this.path + 'dialogs/templates.js' ) );
|
||||
|
||||
editor.addCommand( 'templates', new CKEDITOR.dialogCommand( 'templates' ) );
|
||||
|
||||
editor.ui.addButton( 'Templates',
|
||||
{
|
||||
label : editor.lang.templates.button,
|
||||
command : 'templates'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var templates = {},
|
||||
loadedTemplatesFiles = {};
|
||||
|
||||
CKEDITOR.addTemplates = function( name, definition )
|
||||
{
|
||||
templates[ name ] = definition;
|
||||
};
|
||||
|
||||
CKEDITOR.getTemplates = function( name )
|
||||
{
|
||||
return templates[ name ];
|
||||
};
|
||||
|
||||
CKEDITOR.loadTemplates = function( templateFiles, callback )
|
||||
{
|
||||
// Holds the templates files to be loaded.
|
||||
var toLoad = [];
|
||||
|
||||
// Look for pending template files to get loaded.
|
||||
for ( var i = 0, count = templateFiles.length ; i < count ; i++ )
|
||||
{
|
||||
if ( !loadedTemplatesFiles[ templateFiles[ i ] ] )
|
||||
{
|
||||
toLoad.push( templateFiles[ i ] );
|
||||
loadedTemplatesFiles[ templateFiles[ i ] ] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( toLoad.length )
|
||||
CKEDITOR.scriptLoader.load( toLoad, callback );
|
||||
else
|
||||
setTimeout( callback, 0 );
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The templates definition set to use. It accepts a list of names separated by
|
||||
* comma. It must match definitions loaded with the templates_files setting.
|
||||
* @type String
|
||||
* @default 'default'
|
||||
* @name CKEDITOR.config.templates
|
||||
* @example
|
||||
* config.templates = 'my_templates';
|
||||
*/
|
||||
|
||||
/**
|
||||
* The list of templates definition files to load.
|
||||
* @type (String) Array
|
||||
* @default [ 'plugins/templates/templates/default.js' ]
|
||||
* @example
|
||||
* config.templates_files =
|
||||
* [
|
||||
* '/editor_templates/site_default.js',
|
||||
* 'http://www.example.com/user_templates.js
|
||||
* ];
|
||||
*
|
||||
*/
|
||||
CKEDITOR.config.templates_files =
|
||||
[
|
||||
CKEDITOR.getUrl(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'plugins/templates/templates/default.js' )
|
||||
];
|
||||
|
||||
/**
|
||||
* Whether the "Replace actual contents" checkbox is checked by default in the
|
||||
* Templates dialog.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* config.templates_replaceContent = false;
|
||||
*/
|
||||
CKEDITOR.config.templates_replaceContent = true;
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
(function()
|
||||
{
|
||||
CKEDITOR.plugins.add( 'templates',
|
||||
{
|
||||
requires : [ 'dialog' ],
|
||||
|
||||
init : function( editor )
|
||||
{
|
||||
CKEDITOR.dialog.add( 'templates', CKEDITOR.getUrl( this.path + 'dialogs/templates.js' ) );
|
||||
|
||||
editor.addCommand( 'templates', new CKEDITOR.dialogCommand( 'templates' ) );
|
||||
|
||||
editor.ui.addButton( 'Templates',
|
||||
{
|
||||
label : editor.lang.templates.button,
|
||||
command : 'templates'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var templates = {},
|
||||
loadedTemplatesFiles = {};
|
||||
|
||||
CKEDITOR.addTemplates = function( name, definition )
|
||||
{
|
||||
templates[ name ] = definition;
|
||||
};
|
||||
|
||||
CKEDITOR.getTemplates = function( name )
|
||||
{
|
||||
return templates[ name ];
|
||||
};
|
||||
|
||||
CKEDITOR.loadTemplates = function( templateFiles, callback )
|
||||
{
|
||||
// Holds the templates files to be loaded.
|
||||
var toLoad = [];
|
||||
|
||||
// Look for pending template files to get loaded.
|
||||
for ( var i = 0, count = templateFiles.length ; i < count ; i++ )
|
||||
{
|
||||
if ( !loadedTemplatesFiles[ templateFiles[ i ] ] )
|
||||
{
|
||||
toLoad.push( templateFiles[ i ] );
|
||||
loadedTemplatesFiles[ templateFiles[ i ] ] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( toLoad.length )
|
||||
CKEDITOR.scriptLoader.load( toLoad, callback );
|
||||
else
|
||||
setTimeout( callback, 0 );
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The templates definition set to use. It accepts a list of names separated by
|
||||
* comma. It must match definitions loaded with the templates_files setting.
|
||||
* @type String
|
||||
* @default 'default'
|
||||
* @name CKEDITOR.config.templates
|
||||
* @example
|
||||
* config.templates = 'my_templates';
|
||||
*/
|
||||
|
||||
/**
|
||||
* The list of templates definition files to load.
|
||||
* @type (String) Array
|
||||
* @default [ 'plugins/templates/templates/default.js' ]
|
||||
* @example
|
||||
* config.templates_files =
|
||||
* [
|
||||
* '/editor_templates/site_default.js',
|
||||
* 'http://www.example.com/user_templates.js
|
||||
* ];
|
||||
*
|
||||
*/
|
||||
CKEDITOR.config.templates_files =
|
||||
[
|
||||
CKEDITOR.getUrl(
|
||||
'_source/' + // @Packager.RemoveLine
|
||||
'plugins/templates/templates/default.js' )
|
||||
];
|
||||
|
||||
/**
|
||||
* Whether the "Replace actual contents" checkbox is checked by default in the
|
||||
* Templates dialog.
|
||||
* @type Boolean
|
||||
* @default true
|
||||
* @example
|
||||
* config.templates_replaceContent = false;
|
||||
*/
|
||||
CKEDITOR.config.templates_replaceContent = true;
|
||||
|
||||
@@ -1,94 +1,94 @@
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
// Register a templates definition set named "default".
|
||||
CKEDITOR.addTemplates( 'default',
|
||||
{
|
||||
// The name of sub folder which hold the shortcut preview images of the
|
||||
// templates.
|
||||
imagesPath : CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ),
|
||||
|
||||
// The templates definitions.
|
||||
templates :
|
||||
[
|
||||
{
|
||||
title: 'Image and Title',
|
||||
image: 'template1.gif',
|
||||
description: 'One main image with a title and text that surround the image.',
|
||||
html:
|
||||
'<h3>' +
|
||||
'<img style="margin-right: 10px" height="100" width="100" align="left"/>' +
|
||||
'Type the title here'+
|
||||
'</h3>' +
|
||||
'<p>' +
|
||||
'Type the text here' +
|
||||
'</p>'
|
||||
},
|
||||
{
|
||||
title: 'Strange Template',
|
||||
image: 'template2.gif',
|
||||
description: 'A template that defines two colums, each one with a title, and some text.',
|
||||
html:
|
||||
'<table cellspacing="0" cellpadding="0" style="width:100%" border="0">' +
|
||||
'<tr>' +
|
||||
'<td style="width:50%">' +
|
||||
'<h3>Title 1</h3>' +
|
||||
'</td>' +
|
||||
'<td></td>' +
|
||||
'<td style="width:50%">' +
|
||||
'<h3>Title 2</h3>' +
|
||||
'</td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>' +
|
||||
'Text 1' +
|
||||
'</td>' +
|
||||
'<td></td>' +
|
||||
'<td>' +
|
||||
'Text 2' +
|
||||
'</td>' +
|
||||
'</tr>' +
|
||||
'</table>' +
|
||||
'<p>' +
|
||||
'More text goes here.' +
|
||||
'</p>'
|
||||
},
|
||||
{
|
||||
title: 'Text and Table',
|
||||
image: 'template3.gif',
|
||||
description: 'A title with some text and a table.',
|
||||
html:
|
||||
'<div style="width: 80%">' +
|
||||
'<h3>' +
|
||||
'Title goes here' +
|
||||
'</h3>' +
|
||||
'<table style="width:150px;float: right" cellspacing="0" cellpadding="0" border="1">' +
|
||||
'<caption style="border:solid 1px black">' +
|
||||
'<strong>Table title</strong>' +
|
||||
'</caption>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'</tr>' +
|
||||
'</table>' +
|
||||
'<p>' +
|
||||
'Type the text here' +
|
||||
'</p>' +
|
||||
'</div>'
|
||||
}
|
||||
]
|
||||
});
|
||||
/*
|
||||
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
*/
|
||||
|
||||
// Register a templates definition set named "default".
|
||||
CKEDITOR.addTemplates( 'default',
|
||||
{
|
||||
// The name of sub folder which hold the shortcut preview images of the
|
||||
// templates.
|
||||
imagesPath : CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ),
|
||||
|
||||
// The templates definitions.
|
||||
templates :
|
||||
[
|
||||
{
|
||||
title: 'Image and Title',
|
||||
image: 'template1.gif',
|
||||
description: 'One main image with a title and text that surround the image.',
|
||||
html:
|
||||
'<h3>' +
|
||||
'<img style="margin-right: 10px" height="100" width="100" align="left"/>' +
|
||||
'Type the title here'+
|
||||
'</h3>' +
|
||||
'<p>' +
|
||||
'Type the text here' +
|
||||
'</p>'
|
||||
},
|
||||
{
|
||||
title: 'Strange Template',
|
||||
image: 'template2.gif',
|
||||
description: 'A template that defines two colums, each one with a title, and some text.',
|
||||
html:
|
||||
'<table cellspacing="0" cellpadding="0" style="width:100%" border="0">' +
|
||||
'<tr>' +
|
||||
'<td style="width:50%">' +
|
||||
'<h3>Title 1</h3>' +
|
||||
'</td>' +
|
||||
'<td></td>' +
|
||||
'<td style="width:50%">' +
|
||||
'<h3>Title 2</h3>' +
|
||||
'</td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td>' +
|
||||
'Text 1' +
|
||||
'</td>' +
|
||||
'<td></td>' +
|
||||
'<td>' +
|
||||
'Text 2' +
|
||||
'</td>' +
|
||||
'</tr>' +
|
||||
'</table>' +
|
||||
'<p>' +
|
||||
'More text goes here.' +
|
||||
'</p>'
|
||||
},
|
||||
{
|
||||
title: 'Text and Table',
|
||||
image: 'template3.gif',
|
||||
description: 'A title with some text and a table.',
|
||||
html:
|
||||
'<div style="width: 80%">' +
|
||||
'<h3>' +
|
||||
'Title goes here' +
|
||||
'</h3>' +
|
||||
'<table style="width:150px;float: right" cellspacing="0" cellpadding="0" border="1">' +
|
||||
'<caption style="border:solid 1px black">' +
|
||||
'<strong>Table title</strong>' +
|
||||
'</caption>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'</tr>' +
|
||||
'<tr>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'<td> </td>' +
|
||||
'</tr>' +
|
||||
'</table>' +
|
||||
'<p>' +
|
||||
'Type the text here' +
|
||||
'</p>' +
|
||||
'</div>'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user