14
14
var scale = $layout.attr('designer_scale');
15
15
var regionWidth = $("#region_" + $layout.data().currentRegionId).attr("width");
16
16
var regionHeight = $("#region_" + $layout.data().currentRegionId).attr("height");
17
var applyContentsToIframe = function() {
18
$("#cke_ta_text iframe").contents().find("head").append("" +
17
var applyContentsToIframe = function(field) {
18
//console.log('Applying iframe adjustments to ' + field);
19
$("#cke_" + field + " iframe").contents().find("head").append("" +
21
22
"width: " + regionWidth + "px; " +
73
74
// Bind to instance ready so that we can adjust some things about the editor.
74
75
CKEDITOR.instances["ta_text"].on('instanceReady', function() {
75
76
// Apply scaling to this editor instance
76
applyContentsToIframe();
77
applyContentsToIframe("ta_text");
78
79
// Reapply the background style after switching to source view and back to the normal editing view
79
CKEDITOR.instances["ta_text"].on('contentDom', applyContentsToIframe);
80
CKEDITOR.instances["ta_text"].on('contentDom', function () { applyContentsToIframe("ta_text") });
81
82
// Get the template data
82
83
var data = CKEDITOR.instances["ta_text"].getData();
103
104
CKEDITOR.replace("noDataMessage", CKEDITOR_DEFAULT_CONFIG);
104
105
CKEDITOR.instances["noDataMessage"].on('instanceReady', function () {
105
106
// Apply scaling to this editor instance
106
applyContentsToIframe();
107
applyContentsToIframe("noDataMessage");
108
109
// Reapply the background style after switching to source view and back to the normal editing view
109
CKEDITOR.instances["noDataMessage"].on('contentDom', applyContentsToIframe);
110
CKEDITOR.instances["noDataMessage"].on('contentDom', function () { applyContentsToIframe("noDataMessage") });
111
112
// Get the template data
112
113
var data = CKEDITOR.instances["noDataMessage"].getData();
115
data = "<span style=\"font-size: 48px;\"><span style=\"color: " + color + ";\">" + translations.noDataMessage + "</span></span>";
114
118
// Handle initial template set up
115
data = applyTemplateContentIfNecessary(data, extra);
116
119
data = convertLibraryReferences(data);
118
121
CKEDITOR.instances["noDataMessage"].setData(data);
158
161
// Do we have a media selector?
159
$(".ckeditor_library_select").selectpicker({
161
}).on('changed.bs.select', function (e) {
162
var select = $(e.target);
163
var linkedTo = select.data().linkedTo;
164
var value = $(e.target).find(":selected").data().imageUrl;
166
if (value != "" && linkedTo != null) {
167
if (CKEDITOR.instances[linkedTo] != undefined) {
168
CKEDITOR.instances[linkedTo].insertHtml("<img src=\"" + value + "\" />");
162
var $selectPicker = $(".ckeditor_library_select");
163
if ($selectPicker.length > 0) {
164
$selectPicker.selectpicker({
170
url: $selectPicker.data().searchUrl,
180
preprocessData: function (data) {
182
if (data.hasOwnProperty('data')) {
183
$.each(data.data, function (index, element) {
185
'value': element.mediaId,
186
'text': element.name,
188
'image-url': $selectPicker.data().imageUrl.replace(':id', element.mediaId)
196
preserveSelected: false,
199
.on('changed.bs.select', function (e) {
201
var select = $(e.target);
202
var linkedTo = select.data().linkedTo;
203
var value = $(e.target).find(":selected").data().imageUrl;
205
if (value !== undefined && value !== "" && linkedTo != null) {
206
if (CKEDITOR.instances[linkedTo] != undefined) {
207
CKEDITOR.instances[linkedTo].insertHtml("<img src=\"" + value + "\" />");
173
213
// Turn the background colour into a picker
174
214
$("#backgroundColor").colorpicker();