Skip to content

Commit

Permalink
Fix #20: add classNames to mendixlink plugin for automated testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelte Lagendijk committed Nov 16, 2015
1 parent a370004 commit 0c13e8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*mendix */
CKEDITOR.dialog.add( 'mendixlinkDialog', function( editor ) {
'use strict';

return {
title: 'Mendix Link Properties',
minWidth: 400,
Expand All @@ -18,7 +18,8 @@ CKEDITOR.dialog.add( 'mendixlinkDialog', function( editor ) {
type: 'text',
id: 'mxlinklabel',
label: 'Label of link',

className: 'mx-ckeditor-mxlink-labelText',

setup: function (element) {
this.setValue(element.getText());
},
Expand All @@ -30,28 +31,29 @@ CKEDITOR.dialog.add( 'mendixlinkDialog', function( editor ) {
type: 'select',
id: 'mxlink',
label: 'Microflow with name to execute',
className: 'mx-ckeditor-mxlink-microflowSelect',
items: (function () {
var data = [],
i = null;

// Create an array that contains all the values a person can pick.
if ( typeof editor.mendixWidgetConfig !== 'undefined' && typeof editor.mendixWidgetConfig.microflowLinks !== 'undefined' ){
//console.log(editor);

for (i = 0; i < editor.mendixWidgetConfig.microflowLinks.length; i++){
data.push( [ editor.mendixWidgetConfig.microflowLinks[i].functionNames ] );
}

}

return data;

}()),
'default': '',

setup: function(element) {
// Get the value set on the link.

if (typeof element.$ !== 'undefined'){
var onclickValue = element.$.attributes['data-cke-pa-onclick'].value;
this.setValue(onclickValue.split('CKEditorViewer.mf.exec(\'').join('').split('\', \'__ID__\', \'__GUID__\');').join(''));
Expand All @@ -61,7 +63,7 @@ CKEDITOR.dialog.add( 'mendixlinkDialog', function( editor ) {
},

commit: function(element) {
// Set the value on the link
// Set the value on the link
element.setAttribute('href', '__LINK__');
element.setAttribute('onclick', 'CKEditorViewer.mf.exec(\'' + this.getValue() + '\', \'__ID__\', \'__GUID__\');');
}
Expand All @@ -70,8 +72,9 @@ CKEDITOR.dialog.add( 'mendixlinkDialog', function( editor ) {
type: 'text',
id: 'mxclass',
label: 'CSS Classes on link',
className: 'mx-ckeditor-mxlink-cssText',
'default': 'btn btn-default mx-button',

setup: function (element) {
// Get the value of the class attribute of the link.
this.setValue(element.getAttribute('class').split('mx-microflow-link').join(''));
Expand All @@ -86,7 +89,8 @@ CKEDITOR.dialog.add( 'mendixlinkDialog', function( editor ) {
type: 'text',
id: 'mxtitle',
label: 'Title text on link',

className: 'mx-ckeditor-mxlink-titleText',

setup: function (element) {
// Get the value of the title attribute of the link.
this.setValue(element.getAttribute('title'));
Expand Down
Binary file modified test/widgets/CKEditorForMendix.mpk
Binary file not shown.

0 comments on commit 0c13e8c

Please sign in to comment.