Last active
October 27, 2015 05:08
-
-
Save roniemicro/68d2f04c949ae90d6a52 to your computer and use it in GitHub Desktop.
Modify placeholder.js to allow dropdown(with dynamic item)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. | |
For licensing, see LICENSE.md or http://ckeditor.com/license | |
*/ | |
CKEDITOR.dialog.add("placeholder", function (a) { | |
var b = a.lang.placeholder; | |
a = a.lang.common.generalTab; | |
return { | |
title: b.title, | |
minWidth: 300, | |
minHeight: 80, | |
contents: [{ | |
id: "info", | |
label: a, | |
title: a, | |
elements: [{ | |
id: "name", | |
type: "select", | |
items : [ [ 'Insert placeholder', '' ] ], | |
style: "width: 100%;", | |
label: b.name, | |
"default": "", | |
required: !0, | |
onLoad: function(element) { | |
$('body').trigger(jQuery.Event('CKE.placeholder.onload'), [this]); | |
}, | |
validate: CKEDITOR.dialog.validate.regex(/^[^\[\]<>]+$/, b.invalidName), | |
setup: function (a) { | |
this.setValue(a.data.name) | |
}, | |
commit: function (a) { | |
a.setData("name", this.getValue()) | |
} | |
}] | |
}] | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You cna then use the event to set add the dynamic data like this | |
jQuery(document).ready(function() { | |
jQuery("body") | |
.on('CKE.placeholder.onload', function(e, el){ | |
el.add('Option 1', 'option1') | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment