1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00
This commit is contained in:
Ryan Cramer
2021-12-10 11:38:53 -05:00
parent b78741a564
commit fa98695f4e
2 changed files with 17 additions and 7 deletions

View File

@@ -78,10 +78,11 @@
function loadIframeImagePicker(editor) { function loadIframeImagePicker(editor) {
var $in = jQuery("#Inputfield_id"); var $in = jQuery("#Inputfield_id");
var page_id;
if($in.length) { if($in.length) {
var page_id = $in.val(); page_id = $in.val();
} else { } else {
var page_id = jQuery("#" + editor.name).closest('.Inputfield').attr('data-pid'); page_id = jQuery("#" + editor.name).closest('.Inputfield').attr('data-pid');
} }
var edit_page_id = page_id; var edit_page_id = page_id;
var file = ''; var file = '';
@@ -104,6 +105,7 @@
var nodeParentName = nodeParent.$.nodeName.toUpperCase(); var nodeParentName = nodeParent.$.nodeName.toUpperCase();
var nodeGrandparentName = nodeGrandparent ? nodeGrandparent.$.nodeName.toUpperCase() : ''; var nodeGrandparentName = nodeGrandparent ? nodeGrandparent.$.nodeName.toUpperCase() : '';
var figureNodeSafari = null; var figureNodeSafari = null;
var $repeaterItem = jQuery("#" + editor.name).closest('.InputfieldRepeaterItem');
if(selection.getType() == CKEDITOR.SELECTION_TEXT) { if(selection.getType() == CKEDITOR.SELECTION_TEXT) {
// Safari doesnt support independent selection of figure elements without display:block, // Safari doesnt support independent selection of figure elements without display:block,
@@ -121,12 +123,19 @@
selection.selectElement(figureNodeSafari); selection.selectElement(figureNodeSafari);
} }
} }
if(typeof ckeGetProcessWireConfig != "undefined") { if($repeaterItem.length && $repeaterItem.find('.InputfieldImage').length) {
var dataPageAttr = $repeaterItem.attr('data-page');
if(typeof dataPageAttr !== 'undefined') page_id = parseInt(dataPageAttr);
}
/*
// pwAssetPageID for potential future use
else if(typeof ckeGetProcessWireConfig != "undefined") {
// note: ckeGetProcessWireConfig not yet present in front-end editor // note: ckeGetProcessWireConfig not yet present in front-end editor
var pwCkeSettings = ckeGetProcessWireConfig(editor); var pwCkeSettings = ckeGetProcessWireConfig(editor);
if(pwCkeSettings && pwCkeSettings['pwAssetPageID']) page_id = pwCkeSettings['pwAssetPageID']; if(pwCkeSettings && pwCkeSettings['pwAssetPageID']) page_id = pwCkeSettings['pwAssetPageID'];
} }
*/
selection.lock(); selection.lock();
editor.lockSelection(); editor.lockSelection();
@@ -202,11 +211,12 @@
// when iframe loads, pull the contents into $i // when iframe loads, pull the contents into $i
var $i = $iframe.contents(); var $i = $iframe.contents();
var buttons;
if($i.find("#selected_image").length > 0) { if($i.find("#selected_image").length > 0) {
// if there is a #selected_image element on the page... // if there is a #selected_image element on the page...
var buttons = [ buttons = [
{ {
html: "<i class='fa fa-camera'></i> " + ProcessWire.config.InputfieldCKEditor.pwimage.insertBtn, // "Insert This Image", html: "<i class='fa fa-camera'></i> " + ProcessWire.config.InputfieldCKEditor.pwimage.insertBtn, // "Insert This Image",
click: function() { click: function() {
@@ -345,7 +355,7 @@
$iframe.setTitle("<i class='fa fa-fw fa-picture-o'></i> " + $i.find('title').html()); $iframe.setTitle("<i class='fa fa-fw fa-picture-o'></i> " + $i.find('title').html());
} else { } else {
var buttons = []; buttons = [];
jQuery("button.pw-modal-button, button[type=submit]:visible", $i).each(function() { jQuery("button.pw-modal-button, button[type=submit]:visible", $i).each(function() {
var $button = jQuery(this); var $button = jQuery(this);
var button = { var button = {

File diff suppressed because one or more lines are too long