Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
c1ba6784
Commit
c1ba6784
authored
Apr 12, 2018
by
stanislav.vakulenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ck-editor
parent
7ce3e018
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
210 additions
and
0 deletions
+210
-0
form-cmp/configuration-ckeditor.xml
form-cmp/configuration-ckeditor.xml
+210
-0
No files found.
form-cmp/configuration-ckeditor.xml
0 → 100755
View file @
c1ba6784
<?xml version="1.0" encoding="utf-8"?>
<configuration
version=
"1"
date=
"2018-02-23 18:23:39"
synergyVersion=
"3.15"
>
<objects
version=
"1"
date=
"2018-02-23 18:23:39"
synergyVersion=
"3.15"
>
<customComponent
code=
"include_js_ckeditor"
name=
"CKEditor 4 CDN"
use_in_forms=
"false"
>
<javascript>
jQuery('head').append('
<
script src="https://cdn.ckeditor.com/4.8.0/full-all/ckeditor.js"
><
/script
>
');
</javascript>
<html></html>
</customComponent>
<customComponent
code=
"ckeditor4_extcomponent"
name=
"CKEditor4 Component"
use_in_forms=
"true"
>
<javascript>
var ckeditor;
var textView = jQuery('
<
div
>
');
if(editable) {
function generateUUID () { // Public Domain/MIT
var d = new Date().getTime();
if (typeof performance !== 'undefined'
&&
typeof performance.now === 'function'){
d += performance.now(); //use high-precision timer if available
}
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === 'x' ? r : (r
&
0x3 | 0x8)).toString(16);
});
}
var guid = generateUUID();
view.container.append('
<
textarea name="ckeditor'+guid+'"
><
/textarea
>
');
ckeditor = CKEDITOR.replace('ckeditor'+guid+'',{
// Define the toolbar groups as it is a more accessible solution.
toolbarGroups: [
{ name: 'styles', groups: [ 'styles' ] },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'align', 'list', 'indent', 'blocks', 'bidi', 'paragraph' ] },
{ name: 'colors', groups: [ 'colors' ] },
{ name: 'insert', groups: [ 'insert' ] },
{ name: 'links', groups: [ 'links' ] },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
{ name: 'forms', groups: [ 'forms' ] },
{ name: 'tools', groups: [ 'tools' ] },
{ name: 'others', groups: [ 'others' ] },
{ name: 'about', groups: [ 'about' ] }
],
// Remove the redundant buttons from toolbar groups defined above.
removeButtons: 'Cut,Undo,Redo,Copy,Paste,Format,Styles,Source,Save,NewPage,Preview,Templates,Subscript,Superscript,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Flash,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,PasteText,PasteFromWord,Find,Replace,SelectAll,Scayt,Form,Maximize,About,ShowBlocks,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField',
extraPlugins: 'tableresize',
filebrowserWindowWidth: '640',
filebrowserWindowHeight: '480',
allowedContent: true,
extraAllowedContent: 'table(*)',
bodyClass: 'document-editor',
format_tags: 'p;h1;h2;h3;pre',
stylesSet: [
{ name: 'Narrow image', type: 'widget', widget: 'image', attributes: { 'class': 'image-narrow' } },
{ name: 'Wide image', type: 'widget', widget: 'image', attributes: { 'class': 'image-wide' } },
{ name: 'Marker', element: 'span', attributes: { 'class': 'marker' } },
{ name: 'Cited Work', element: 'cite' },
{ name: 'Inline Quotation', element: 'q' },
/* Inline Styles */
{ name: 'Marker', element: 'span', attributes: { 'class': 'marker' } },
{ name: 'Cited Work', element: 'cite' },
{ name: 'Inline Quotation', element: 'q' },
/* Object Styles */
{
name: 'Special Container',
element: 'div',
styles: {
padding: '5px 10px',
background: '#eee',
border: '1px solid #ccc'
}
},
{
name: 'Compact table',
element: 'table',
attributes: {
cellpadding: '5',
cellspacing: '0',
border: '1',
bordercolor: '#ccc'
},
styles: {
'border-collapse': 'collapse'
}
},
{ name: 'Borderless Table', element: 'table', styles: { 'border-style': 'hidden', 'background-color': '#E6E6FA' } },
{ name: 'Square Bulleted List', element: 'ul', styles: { 'list-style-type': 'square' } }
]
,
contentsCss: [ CKEDITOR.basePath + 'contents.css', 'https://sdk.ckeditor.com/samples/assets/css/widgetstyles.css', window.location.host + '/Synergy/css/my_style_ckeditor.css'],
image2_alignClasses: [ 'image-align-left', 'image-align-center', 'image-align-right' ],
image2_disableResizer: true,
height: 470,
uiColor: '#E5E5E5',
language: AS.OPTIONS.locale
});
ckeditor.setData(model.getValue());
ckeditor.on('change', function() {
model.setValue(ckeditor.getData());
});
ckeditor.on('paste', function( evt ) {
var file, i, el, loader;
if (evt.data.dataValue === '') {
for ( i = 0; i
<
evt.data.dataTransfer.getFilesCount(); i++ ) {
file = evt.data.dataTransfer.getFile( i );
if (CKEDITOR.fileTools.isTypeSupported( file, /image\/(jpeg|png|gif|bmp)/)) {
var f = evt.data.dataTransfer.getFile(i);
var reader = new FileReader();
reader.onload = function(evt) {
var element = ckeditor.document.createElement('img', {
attributes: {
src: evt.srcElement.result
}
});
ckeditor.insertElement(element);
};
reader.readAsDataURL(f);
}
}
} else {
debugger;
var tableSource = evt.data.dataValue;
if (tableSource.indexOf('
<
table ') !== -1) {
tableSource = tableSource.replace('border="0"', '');
tableSource = tableSource.replace('class=" cke_show_border"', '');
tableSource = tableSource.replace('
<
table ', '
<
table bordercolor="#d0d0d0" border="1px" style="border-collapse: collapse;"');
tableSource = tableSource.replace(new RegExp('border:none;', 'g'), '');
evt.data.dataValue = tableSource;
}
}
});
CKEDITOR.on('dialogDefinition', function(ev) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if(dialogName == 'image') {
dialogDefinition.onLoad = function () {
var dialog = CKEDITOR.dialog.getCurrent();
dialog.hidePage('Link' );
dialog.hidePage('advanced' );
};
}
});
} else {
view.container.append(textView);
textView.html(model.getValue());
}
model.textValue = "";
model.updateTextView = function () {
if(!model.getValue()) {
model.textValue = "";
model.trigger(AS.FORMS.EVENT_TYPE.dataLoad, [model]);
return;
}
};
model.getTextValue = function(){
return model.textValue;
};
model.setAsfData = function(asfData){
model.setValue(asfData.value);
};
model.getAsfData = function(blockNumber){
return AS.FORMS.ASFDataUtils.getBaseAsfData(model.asfProperty, blockNumber, model.value, null);
};
view.updateValueFromModel = function(){
textView.html(model.getValue());
};
</javascript>
<html></html>
</customComponent>
<externalModuleComponent
code=
"include_js_ckeditor"
name=
"Подключение CKEditor 4"
path=
"main"
action_type=
"ADD"
comp_code=
"include_js_ckeditor"
/>
</objects>
<dependencies>
<dependency
dependingObjectType=
"1073741836"
dependingObjectCode=
"include_js_ckeditor"
ownerObjectType=
"268435456"
ownerObjectCode=
"include_js_ckeditor"
/>
</dependencies>
</configuration>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment