Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../assets/js
File: preview.js
self.each(nodes, function eachNodeInSerializer (node) {
[1000] Fix | Delete
if (node.firstChild == node.lastChild) {
[1001] Fix | Delete
if (node.firstChild && 'value' in node.firstChild && (node.firstChild.value === ' ' || !node.firstChild.value.trim().length)) {
[1002] Fix | Delete
node.remove();
[1003] Fix | Delete
}
[1004] Fix | Delete
}
[1005] Fix | Delete
});
[1006] Fix | Delete
});
[1007] Fix | Delete
[1008] Fix | Delete
//@todo:isthiseachreallynecessary?
[1009] Fix | Delete
// Add event to reconfigure wrappers every time the content is loaded
[1010] Fix | Delete
tinymce.each(tinymce.editors, function onEachEditor (editor) {
[1011] Fix | Delete
self.addEvent('loadContent', editor, function onInitEditor (ed) {
[1012] Fix | Delete
self.configureWrappers(editor);
[1013] Fix | Delete
});
[1014] Fix | Delete
});
[1015] Fix | Delete
[1016] Fix | Delete
// Add the edit form
[1017] Fix | Delete
[1018] Fix | Delete
// @todo: This is needed only for JCE, to fix the img placeholder. Try to find out a better approach to avoid the placeholder blink
[1019] Fix | Delete
window.setTimeout(
[1020] Fix | Delete
function afterTimeoutOnFindEditor () {
[1021] Fix | Delete
/*
[1022] Fix | Delete
* This is required because after load/refresh the page, the
[1023] Fix | Delete
* onLoadContent is not being triggered automatically, so
[1024] Fix | Delete
* we force the event
[1025] Fix | Delete
*/
[1026] Fix | Delete
editorInstance.load();
[1027] Fix | Delete
},
[1028] Fix | Delete
// If in JCE the user see the placeholder (img) instead of the iframe after load/refresh the pagr, this time is too short
[1029] Fix | Delete
500
[1030] Fix | Delete
);
[1031] Fix | Delete
}
[1032] Fix | Delete
[1033] Fix | Delete
// Let's make sure the inner doc has been fully loaded first.
[1034] Fix | Delete
var checkTimesLimit = 100;
[1035] Fix | Delete
var checkIndex = 0;
[1036] Fix | Delete
var statusCheckerInterval = setInterval(function () {
[1037] Fix | Delete
if (checkIndex === checkTimesLimit) {
[1038] Fix | Delete
clearInterval(statusCheckerInterval);
[1039] Fix | Delete
alert('For some reason TinyMCE was not fully loaded yet. Please, refresh the page and try again.');
[1040] Fix | Delete
} else {
[1041] Fix | Delete
var doc = editorInstance.getDoc();
[1042] Fix | Delete
if (doc) {
[1043] Fix | Delete
clearInterval(statusCheckerInterval);
[1044] Fix | Delete
onFindEditorCallback();
[1045] Fix | Delete
} else {
[1046] Fix | Delete
checkIndex++;
[1047] Fix | Delete
}
[1048] Fix | Delete
}
[1049] Fix | Delete
}, 250);
[1050] Fix | Delete
};
[1051] Fix | Delete
[1052] Fix | Delete
self.fixIframeSize = function (iframe) {
[1053] Fix | Delete
var maxWidth = 480;
[1054] Fix | Delete
if ($(iframe).width() > maxWidth && !$(iframe).data('size-fixed')) {
[1055] Fix | Delete
var ratio = $(iframe).height() / $(iframe).width();
[1056] Fix | Delete
$(iframe).width(maxWidth);
[1057] Fix | Delete
$(iframe).height(maxWidth * ratio);
[1058] Fix | Delete
$(iframe).css('max-width', maxWidth);
[1059] Fix | Delete
$(iframe).attr('max-width', maxWidth);
[1060] Fix | Delete
[1061] Fix | Delete
$(iframe).data('size-fixed', true);
[1062] Fix | Delete
}
[1063] Fix | Delete
};
[1064] Fix | Delete
[1065] Fix | Delete
/**
[1066] Fix | Delete
* Function triggered on mouse enter the wrapper
[1067] Fix | Delete
*
[1068] Fix | Delete
* @param object e The event
[1069] Fix | Delete
* @return void
[1070] Fix | Delete
*/
[1071] Fix | Delete
self.onMouseEnter = function (e, editorInstance) {
[1072] Fix | Delete
self.displayPreviewControllerPanel($(e.currentTarget), editorInstance);
[1073] Fix | Delete
};
[1074] Fix | Delete
[1075] Fix | Delete
/**
[1076] Fix | Delete
* Function triggered on mouse get out of the wrapper
[1077] Fix | Delete
*
[1078] Fix | Delete
* @param object e The event
[1079] Fix | Delete
* @return void
[1080] Fix | Delete
*/
[1081] Fix | Delete
self.onMouseOut = function (e) {
[1082] Fix | Delete
// Check if the destiny is not a child element
[1083] Fix | Delete
// Chrome
[1084] Fix | Delete
if (self.isDefined(e.toElement)) {
[1085] Fix | Delete
if (e.toElement.parentElement == e.fromElement
[1086] Fix | Delete
|| $(e.toElement).hasClass('embedpress_ignore_mouseout')
[1087] Fix | Delete
) {
[1088] Fix | Delete
return false;
[1089] Fix | Delete
}
[1090] Fix | Delete
}
[1091] Fix | Delete
[1092] Fix | Delete
// Firefox
[1093] Fix | Delete
if (self.isDefined(e.relatedTarget)) {
[1094] Fix | Delete
if ($(e.relatedTarget).hasClass('embedpress_ignore_mouseout')) {
[1095] Fix | Delete
return false;
[1096] Fix | Delete
}
[1097] Fix | Delete
}
[1098] Fix | Delete
[1099] Fix | Delete
self.hidePreviewControllerPanel();
[1100] Fix | Delete
};
[1101] Fix | Delete
[1102] Fix | Delete
/**
[1103] Fix | Delete
* Callback triggered by paste events. This should be hooked by TinyMCE's paste_preprocess
[1104] Fix | Delete
* setting. A normal bind to the onPaste event doesn't work correctly all the times
[1105] Fix | Delete
* (specially when you copy and paste content from the same editor).
[1106] Fix | Delete
*
[1107] Fix | Delete
* @param mixed - plugin
[1108] Fix | Delete
* @param mixed - args
[1109] Fix | Delete
*
[1110] Fix | Delete
* @return void
[1111] Fix | Delete
*/
[1112] Fix | Delete
[1113] Fix | Delete
self.onPaste = function (plugin, args) {
[1114] Fix | Delete
var urlPatternRegex = new RegExp(/(https?):\/\/([w]{3}\.)?.+?(?:\s|$)/i);
[1115] Fix | Delete
var urlPatternsList = self.getProvidersURLPatterns();
[1116] Fix | Delete
[1117] Fix | Delete
// Split the pasted content into separated lines.
[1118] Fix | Delete
var contentLines = args.content.split(/\n/g) || [];
[1119] Fix | Delete
contentLines = contentLines.map(function (line, itemIndex) {
[1120] Fix | Delete
// Check if there's a url into `line`.
[1121] Fix | Delete
if (line.match(urlPatternRegex)) {
[1122] Fix | Delete
// Split the current line across its space-characters to isolate the url.
[1123] Fix | Delete
let termsList = line.trim().split(/\s+/);
[1124] Fix | Delete
termsList = termsList.map(function (term, termIndex) {
[1125] Fix | Delete
// Check if the term into the current line is a url.
[1126] Fix | Delete
var match = term.match(urlPatternRegex);
[1127] Fix | Delete
if (match) {
[1128] Fix | Delete
for (var urlPatternIndex = 0; urlPatternIndex < urlPatternsList.length; urlPatternIndex++) {
[1129] Fix | Delete
// Isolates that url from the rest of the content if the service is supported.
[1130] Fix | Delete
var urlPattern = new RegExp(urlPatternsList[urlPatternIndex]);
[1131] Fix | Delete
if (urlPattern.test(term)) {
[1132] Fix | Delete
return '</p><p>' + match[0] + '</p><p>';
[1133] Fix | Delete
}
[1134] Fix | Delete
}
[1135] Fix | Delete
}
[1136] Fix | Delete
[1137] Fix | Delete
return term;
[1138] Fix | Delete
});
[1139] Fix | Delete
[1140] Fix | Delete
termsList[termsList.length - 1] = termsList[termsList.length - 1] + '<br>';
[1141] Fix | Delete
[1142] Fix | Delete
line = termsList.join(' ');
[1143] Fix | Delete
}
[1144] Fix | Delete
[1145] Fix | Delete
return line;
[1146] Fix | Delete
});
[1147] Fix | Delete
[1148] Fix | Delete
// Check if the text was transformed or not. If it was, add wrappers
[1149] Fix | Delete
var content = contentLines.join('');
[1150] Fix | Delete
[1151] Fix | Delete
if (content.replace(/<br>$/, '') !== args.content) {
[1152] Fix | Delete
args.content = '<p>' + args.content + '</p>';
[1153] Fix | Delete
}
[1154] Fix | Delete
};
[1155] Fix | Delete
[1156] Fix | Delete
/**
[1157] Fix | Delete
* Method trigered on every node change, to detect new lines. It will
[1158] Fix | Delete
* try to fix a default behavior for some editors of clone the parent
[1159] Fix | Delete
* element when adding a line break. This will clone the embed wrapper
[1160] Fix | Delete
* if we set the cursor after a preview wrapper and hit enter.
[1161] Fix | Delete
*
[1162] Fix | Delete
* @param object e The event
[1163] Fix | Delete
* @return void
[1164] Fix | Delete
*/
[1165] Fix | Delete
self.onNodeChange = function (e) {
[1166] Fix | Delete
// Fix the clone parent on break lines issue
[1167] Fix | Delete
// Check if a line break was added
[1168] Fix | Delete
if (e.element.tagName === 'BR') {
[1169] Fix | Delete
// Check one of the parent elements is a clonned embed wrapper
[1170] Fix | Delete
if (e.parents.length > 0) {
[1171] Fix | Delete
$.each(e.parents, function (index, parent) {
[1172] Fix | Delete
if ($(parent).hasClass('embedpress_wrapper')) {
[1173] Fix | Delete
// Remove the cloned wrapper and replace with a 'br' tag
[1174] Fix | Delete
$(parent).replaceWith($('<br>'));
[1175] Fix | Delete
}
[1176] Fix | Delete
});
[1177] Fix | Delete
}
[1178] Fix | Delete
} else if (e.element.tagName === 'IFRAME') {
[1179] Fix | Delete
if (e.parents.length > 0) {
[1180] Fix | Delete
$.each(e.parents, function (index, parent) {
[1181] Fix | Delete
parent = $(parent);
[1182] Fix | Delete
if (parent.hasClass('embedpress_wrapper')) {
[1183] Fix | Delete
var wrapper = $('.embedpress-wrapper', parent);
[1184] Fix | Delete
if (wrapper.length > 1) {
[1185] Fix | Delete
wrapper.get(0).remove();
[1186] Fix | Delete
}
[1187] Fix | Delete
}
[1188] Fix | Delete
});
[1189] Fix | Delete
}
[1190] Fix | Delete
}
[1191] Fix | Delete
};
[1192] Fix | Delete
[1193] Fix | Delete
self.onKeyDown = function (e, editorInstance) {
[1194] Fix | Delete
var node = editorInstance.selection.getNode();
[1195] Fix | Delete
[1196] Fix | Delete
if (e.keyCode == 8 || e.keyCode == 46) {
[1197] Fix | Delete
if (node.nodeName.toLowerCase() === 'p') {
[1198] Fix | Delete
var children = $(node).children();
[1199] Fix | Delete
if (children.length > 0) {
[1200] Fix | Delete
$.each(children, function () {
[1201] Fix | Delete
// On delete, make sure to remove the wrapper and children, not only the wrapper
[1202] Fix | Delete
if ($(this).hasClass('embedpress_wrapper') || $(this).hasClass('embedpress_ignore_mouseout')) {
[1203] Fix | Delete
$(this).remove();
[1204] Fix | Delete
[1205] Fix | Delete
editorInstance.focus();
[1206] Fix | Delete
}
[1207] Fix | Delete
});
[1208] Fix | Delete
}
[1209] Fix | Delete
}
[1210] Fix | Delete
} else {
[1211] Fix | Delete
// Ignore the arrows keys
[1212] Fix | Delete
var arrowsKeyCodes = [37, 38, 39, 40];
[1213] Fix | Delete
if (arrowsKeyCodes.indexOf(e.keyCode) == -1) {
[1214] Fix | Delete
[1215] Fix | Delete
// Check if we are inside a preview wrapper
[1216] Fix | Delete
if ($(node).hasClass('embedpress_wrapper') || $(node).hasClass('embedpress_ignore_mouseout')) {
[1217] Fix | Delete
// Avoid delete the wrapper or block line break if we are inside the wrapper
[1218] Fix | Delete
if (e.keyCode == 13) {
[1219] Fix | Delete
wrapper = $(self.getWrapperFromChild(node));
[1220] Fix | Delete
if (wrapper.length > 0) {
[1221] Fix | Delete
// Creates a temporary element which will be inserted after the wrapper
[1222] Fix | Delete
var tmpId = '__embedpress__tmp_' + self.makeId();
[1223] Fix | Delete
wrapper.after($('<span id="' + tmpId + '"></span>'));
[1224] Fix | Delete
// Get and select the temporary element
[1225] Fix | Delete
var span = editorInstance.dom.select('span#' + tmpId)[0];
[1226] Fix | Delete
editorInstance.selection.select(span);
[1227] Fix | Delete
// Remove the temporary element
[1228] Fix | Delete
$(span).remove();
[1229] Fix | Delete
}
[1230] Fix | Delete
[1231] Fix | Delete
return true;
[1232] Fix | Delete
} else {
[1233] Fix | Delete
// If we are inside the embed preview, ignore any key to avoid edition
[1234] Fix | Delete
return self.cancelEvent(e, editorInstance);
[1235] Fix | Delete
}
[1236] Fix | Delete
}
[1237] Fix | Delete
}
[1238] Fix | Delete
}
[1239] Fix | Delete
[1240] Fix | Delete
return true;
[1241] Fix | Delete
};
[1242] Fix | Delete
[1243] Fix | Delete
self.getWrapperFromChild = function (element) {
[1244] Fix | Delete
// Is the wrapper
[1245] Fix | Delete
if ($(element).hasClass('embedpress_wrapper')) {
[1246] Fix | Delete
return element;
[1247] Fix | Delete
} else {
[1248] Fix | Delete
var $parent = $(element).parent();
[1249] Fix | Delete
[1250] Fix | Delete
if ($parent.length > 0) {
[1251] Fix | Delete
return self.getWrapperFromChild($parent[0]);
[1252] Fix | Delete
}
[1253] Fix | Delete
}
[1254] Fix | Delete
[1255] Fix | Delete
return false;
[1256] Fix | Delete
};
[1257] Fix | Delete
[1258] Fix | Delete
self.onUndo = function (e, editorInstance) {
[1259] Fix | Delete
// Force re-render everything
[1260] Fix | Delete
editorInstance.load();
[1261] Fix | Delete
};
[1262] Fix | Delete
[1263] Fix | Delete
self.cancelEvent = function (e, editorInstance) {
[1264] Fix | Delete
e.preventDefault();
[1265] Fix | Delete
e.stopPropagation();
[1266] Fix | Delete
editorInstance.dom.events.cancel();
[1267] Fix | Delete
[1268] Fix | Delete
return false;
[1269] Fix | Delete
};
[1270] Fix | Delete
[1271] Fix | Delete
/**
[1272] Fix | Delete
* Method executed when the edit button is clicked. It will display
[1273] Fix | Delete
* a field with the current url, to update the current embed's source
[1274] Fix | Delete
* url.
[1275] Fix | Delete
*
[1276] Fix | Delete
* @param Object e The event
[1277] Fix | Delete
* @return void
[1278] Fix | Delete
*/
[1279] Fix | Delete
self.onClickEditButton = function (e, editorInstance) {
[1280] Fix | Delete
// Prevent edition of the panel
[1281] Fix | Delete
self.cancelEvent(e, editorInstance);
[1282] Fix | Delete
[1283] Fix | Delete
self.activeWrapperForModal = self.activeWrapper;
[1284] Fix | Delete
[1285] Fix | Delete
var $wrapper = self.activeWrapperForModal;
[1286] Fix | Delete
var wrapperUid = $wrapper.prop('id').replace('embedpress_wrapper_', '');
[1287] Fix | Delete
[1288] Fix | Delete
var customAttributes = {};
[1289] Fix | Delete
[1290] Fix | Delete
var $embedInnerWrapper = $('.embedpress-wrapper', $wrapper);
[1291] Fix | Delete
var embedItem = $('iframe', $wrapper);
[1292] Fix | Delete
if (!embedItem.length) {
[1293] Fix | Delete
embedItem = null;
[1294] Fix | Delete
}
[1295] Fix | Delete
if ($embedInnerWrapper.length > 1){
[1296] Fix | Delete
$.each($embedInnerWrapper[0].attributes, function () {
[1297] Fix | Delete
if (this.specified) {
[1298] Fix | Delete
if (this.name !== 'class') {
[1299] Fix | Delete
customAttributes[this.name.replace('data-', '').toLowerCase()] = this.value;
[1300] Fix | Delete
}
[1301] Fix | Delete
}
[1302] Fix | Delete
});
[1303] Fix | Delete
}
[1304] Fix | Delete
[1305] Fix | Delete
[1306] Fix | Delete
var embedWidth = (((embedItem && embedItem.width()) || $embedInnerWrapper.data('width')) || $embedInnerWrapper.width()) || '';
[1307] Fix | Delete
var embedHeight = (((embedItem && embedItem.height()) || $embedInnerWrapper.data('height')) || $embedInnerWrapper.height()) || '';
[1308] Fix | Delete
[1309] Fix | Delete
embedItem = $embedInnerWrapper = null;
[1310] Fix | Delete
[1311] Fix | Delete
$('<div class="loader-indicator"><i class="embedpress-icon-reload"></i></div>').appendTo($wrapper);
[1312] Fix | Delete
[1313] Fix | Delete
setTimeout(function () {
[1314] Fix | Delete
$.ajax({
[1315] Fix | Delete
type: 'GET',
[1316] Fix | Delete
url: self.params.baseUrl + 'wp-admin/admin-ajax.php',
[1317] Fix | Delete
data: {
[1318] Fix | Delete
action: 'embedpress_get_embed_url_info',
[1319] Fix | Delete
url: self.decodeEmbedURLSpecialChars($wrapper.data('url'), false)
[1320] Fix | Delete
},
[1321] Fix | Delete
beforeSend: function (request, requestSettings) {
[1322] Fix | Delete
$('.loader-indicator', $wrapper).addClass('is-loading');
[1323] Fix | Delete
},
[1324] Fix | Delete
success: function (response) {
[1325] Fix | Delete
if (!response) {
[1326] Fix | Delete
bootbox.alert('Unable to get a valid response from the server.');
[1327] Fix | Delete
return;
[1328] Fix | Delete
}
[1329] Fix | Delete
if (response.canBeResponsive) {
[1330] Fix | Delete
var embedShouldBeResponsive = true;
[1331] Fix | Delete
if ('width' in customAttributes || 'height' in customAttributes) {
[1332] Fix | Delete
embedShouldBeResponsive = false;
[1333] Fix | Delete
} else if ('responsive' in customAttributes && customAttributes['responsive'].isFalse()) {
[1334] Fix | Delete
embedShouldBeResponsive = false;
[1335] Fix | Delete
}
[1336] Fix | Delete
}
[1337] Fix | Delete
[1338] Fix | Delete
bootbox.dialog({
[1339] Fix | Delete
className: 'embedpress-modal',
[1340] Fix | Delete
title: 'Editing Embed properties',
[1341] Fix | Delete
message: '<form id="form-' + wrapperUid + '" embedpress>' +
[1342] Fix | Delete
'<div class="row">' +
[1343] Fix | Delete
'<div class="col-md-12">' +
[1344] Fix | Delete
'<div class="form-group">' +
[1345] Fix | Delete
'<label for="input-url-' + wrapperUid + '">Url</label>' +
[1346] Fix | Delete
'<input class="form-control" type="url" id="input-url-' + wrapperUid + '" value="' + self.decodeEmbedURLSpecialChars($wrapper.data('url'), false) + '">' +
[1347] Fix | Delete
'</div>' +
[1348] Fix | Delete
'</div>' +
[1349] Fix | Delete
'</div>' +
[1350] Fix | Delete
'<div class="row">' +
[1351] Fix | Delete
(response.canBeResponsive ?
[1352] Fix | Delete
'<div class="col-md-12">' +
[1353] Fix | Delete
'<label>Responsive</label>' +
[1354] Fix | Delete
'<div class="form-group">' +
[1355] Fix | Delete
'<label class="radio-inline">' +
[1356] Fix | Delete
'<input type="radio" name="input-responsive-' + wrapperUid + '" id="input-responsive-1-' + wrapperUid + '" value="1"' + (embedShouldBeResponsive ? ' checked="checked"' : '') + '> Yes' +
[1357] Fix | Delete
'</label>' +
[1358] Fix | Delete
'<label class="radio-inline">' +
[1359] Fix | Delete
'<input type="radio" name="input-responsive-' + wrapperUid + '" id="input-responsive-0-' + wrapperUid + '" value="0"' + (!embedShouldBeResponsive ? ' checked="checked"' : '') + '> No' +
[1360] Fix | Delete
'</label>' +
[1361] Fix | Delete
'</div>' +
[1362] Fix | Delete
'</div>' : '') +
[1363] Fix | Delete
'<div class="col-md-6">' +
[1364] Fix | Delete
'<div class="form-group">' +
[1365] Fix | Delete
'<label for="input-width-' + wrapperUid + '">Width</label>' +
[1366] Fix | Delete
'<input class="form-control" type="integer" id="input-width-' + wrapperUid + '" value="' + embedWidth + '"' + (embedShouldBeResponsive ? ' disabled' : '') + '>' +
[1367] Fix | Delete
'</div>' +
[1368] Fix | Delete
'</div>' +
[1369] Fix | Delete
'<div class="col-md-6">' +
[1370] Fix | Delete
'<div class="form-group">' +
[1371] Fix | Delete
'<label for="input-height-' + wrapperUid + '">Height</label>' +
[1372] Fix | Delete
'<input class="form-control" type="integer" id="input-height-' + wrapperUid + '" value="' + embedHeight + '"' + (embedShouldBeResponsive ? ' disabled' : '') + '>' +
[1373] Fix | Delete
'</div>' +
[1374] Fix | Delete
'</div>' +
[1375] Fix | Delete
'</div>' +
[1376] Fix | Delete
'</form>',
[1377] Fix | Delete
buttons: {
[1378] Fix | Delete
danger: {
[1379] Fix | Delete
label: 'Cancel',
[1380] Fix | Delete
className: 'btn-default',
[1381] Fix | Delete
callback: function () {
[1382] Fix | Delete
// do nothing
[1383] Fix | Delete
self.activeWrapperForModal = null;
[1384] Fix | Delete
}
[1385] Fix | Delete
},
[1386] Fix | Delete
success: {
[1387] Fix | Delete
label: 'Save',
[1388] Fix | Delete
className: 'btn-primary',
[1389] Fix | Delete
callback: function () {
[1390] Fix | Delete
var $wrapper = self.activeWrapperForModal;
[1391] Fix | Delete
[1392] Fix | Delete
// Select the current wrapper as a base for the new element
[1393] Fix | Delete
editorInstance.focus();
[1394] Fix | Delete
editorInstance.selection.select($wrapper[0]);
[1395] Fix | Delete
[1396] Fix | Delete
$wrapper.children().remove();
[1397] Fix | Delete
$wrapper.remove();
[1398] Fix | Delete
[1399] Fix | Delete
if (response.canBeResponsive) {
[1400] Fix | Delete
if ($('#form-' + wrapperUid + ' input[name="input-responsive-' + wrapperUid + '"]:checked').val().isFalse()) {
[1401] Fix | Delete
var embedCustomWidth = $('#input-width-' + wrapperUid).val();
[1402] Fix | Delete
if (parseInt(embedCustomWidth) > 0) {
[1403] Fix | Delete
customAttributes['width'] = embedCustomWidth;
[1404] Fix | Delete
}
[1405] Fix | Delete
[1406] Fix | Delete
var embedCustomHeight = $('#input-height-' + wrapperUid).val();
[1407] Fix | Delete
if (parseInt(embedCustomHeight) > 0) {
[1408] Fix | Delete
customAttributes['height'] = embedCustomHeight;
[1409] Fix | Delete
}
[1410] Fix | Delete
[1411] Fix | Delete
customAttributes['responsive'] = 'false';
[1412] Fix | Delete
} else {
[1413] Fix | Delete
delete customAttributes['width'];
[1414] Fix | Delete
delete customAttributes['height'];
[1415] Fix | Delete
[1416] Fix | Delete
customAttributes['responsive'] = 'true';
[1417] Fix | Delete
}
[1418] Fix | Delete
} else {
[1419] Fix | Delete
var embedCustomWidth = $('#input-width-' + wrapperUid).val();
[1420] Fix | Delete
if (parseInt(embedCustomWidth) > 0) {
[1421] Fix | Delete
customAttributes['width'] = embedCustomWidth;
[1422] Fix | Delete
}
[1423] Fix | Delete
[1424] Fix | Delete
var embedCustomHeight = $('#input-height-' + wrapperUid).val();
[1425] Fix | Delete
if (parseInt(embedCustomHeight) > 0) {
[1426] Fix | Delete
customAttributes['height'] = embedCustomHeight;
[1427] Fix | Delete
}
[1428] Fix | Delete
}
[1429] Fix | Delete
[1430] Fix | Delete
var customAttributesList = [];
[1431] Fix | Delete
if (!!Object.keys(customAttributes).length) {
[1432] Fix | Delete
for (var attrName in customAttributes) {
[1433] Fix | Delete
customAttributesList.push(attrName + '="' + customAttributes[attrName] + '"');
[1434] Fix | Delete
}
[1435] Fix | Delete
}
[1436] Fix | Delete
[1437] Fix | Delete
var shortcode = '[' + $data.EMBEDPRESS_SHORTCODE + (customAttributesList.length > 0 ? ' ' + customAttributesList.join(' ') : '') + ']' + $('#input-url-' + wrapperUid).val() + '[/' + $data.EMBEDPRESS_SHORTCODE + ']';
[1438] Fix | Delete
// We do not directly replace the node because it was causing a bug on a second edit attempt
[1439] Fix | Delete
editorInstance.execCommand('mceInsertContent', false, shortcode);
[1440] Fix | Delete
[1441] Fix | Delete
self.configureWrappers(editorInstance);
[1442] Fix | Delete
}
[1443] Fix | Delete
}
[1444] Fix | Delete
}
[1445] Fix | Delete
});
[1446] Fix | Delete
[1447] Fix | Delete
$('form[embedpress]').on('change', 'input[type="radio"]', function (e) {
[1448] Fix | Delete
var self = $(this);
[1449] Fix | Delete
var form = self.parents('form[embedpress]');
[1450] Fix | Delete
[1451] Fix | Delete
$('input[type="integer"]', form).prop('disabled', self.val().isTrue());
[1452] Fix | Delete
});
[1453] Fix | Delete
},
[1454] Fix | Delete
complete: function (request, textStatus) {
[1455] Fix | Delete
$('.loader-indicator', $wrapper).removeClass('is-loading');
[1456] Fix | Delete
[1457] Fix | Delete
setTimeout(function () {
[1458] Fix | Delete
$('.loader-indicator', $wrapper).remove();
[1459] Fix | Delete
}, 350);
[1460] Fix | Delete
},
[1461] Fix | Delete
dataType: 'json',
[1462] Fix | Delete
async: true
[1463] Fix | Delete
});
[1464] Fix | Delete
}, 200);
[1465] Fix | Delete
[1466] Fix | Delete
return false;
[1467] Fix | Delete
};
[1468] Fix | Delete
[1469] Fix | Delete
/**
[1470] Fix | Delete
* Method executed when the remove button is clicked. It will remove
[1471] Fix | Delete
* the preview and embed code, adding a mark to ignore the url
[1472] Fix | Delete
*
[1473] Fix | Delete
* @param Object e The event
[1474] Fix | Delete
* @return void
[1475] Fix | Delete
*/
[1476] Fix | Delete
self.onClickRemoveButton = function (e, editorInstance) {
[1477] Fix | Delete
// Prevent edition of the panel
[1478] Fix | Delete
self.cancelEvent(e, editorInstance);
[1479] Fix | Delete
[1480] Fix | Delete
var $wrapper = self.activeWrapper;
[1481] Fix | Delete
[1482] Fix | Delete
$wrapper.children().remove();
[1483] Fix | Delete
$wrapper.remove();
[1484] Fix | Delete
[1485] Fix | Delete
return false;
[1486] Fix | Delete
};
[1487] Fix | Delete
[1488] Fix | Delete
self.recursivelyAddClass = function (element, className) {
[1489] Fix | Delete
$(element).children().each(function (index, child) {
[1490] Fix | Delete
$(child).addClass(className);
[1491] Fix | Delete
[1492] Fix | Delete
var grandChild = $(child).children();
[1493] Fix | Delete
if (grandChild.length > 0) {
[1494] Fix | Delete
self.recursivelyAddClass(child, className);
[1495] Fix | Delete
}
[1496] Fix | Delete
});
[1497] Fix | Delete
};
[1498] Fix | Delete
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function