mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +02:00
Update TinyMCE and CKEditor modules to recognize versions in URLs
This commit is contained in:
@@ -180,6 +180,14 @@
|
||||
|
||||
var modalUri = ProcessWire.config.urls.admin + 'page/image/';
|
||||
var queryString = '?id=' + page_id + '&edit_page_id=' + edit_page_id + '&modal=1';
|
||||
var version = 0;
|
||||
|
||||
if(typeof ProcessWire.config.PagesVersions !== 'undefined') {
|
||||
if(ProcessWire.config.PagesVersions.page == page_id) {
|
||||
version = ProcessWire.config.PagesVersions.version;
|
||||
queryString += '&version=' + version;
|
||||
}
|
||||
}
|
||||
|
||||
if(file.length) queryString += "&file=" + file;
|
||||
if(imgWidth) queryString += "&width=" + imgWidth;
|
||||
@@ -320,7 +328,8 @@
|
||||
'&file=' + file +
|
||||
'&width=' + width +
|
||||
'&height=' + height +
|
||||
'&hidpi=' + hidpi;
|
||||
'&hidpi=' + hidpi +
|
||||
'&version=' + version;
|
||||
|
||||
if(rotate) resizeURL += '&rotate=' + rotate;
|
||||
if($img.hasClass('flip_horizontal')) resizeURL += '&flip=h';
|
||||
@@ -339,7 +348,7 @@
|
||||
click: function() {
|
||||
var $i = $iframe.contents();
|
||||
var page_id = jQuery("#page_id", $i).val();
|
||||
$iframe.attr('src', modalUri + '?id=' + page_id + '&modal=1');
|
||||
$iframe.attr('src', modalUri + '?id=' + page_id + '&modal=1&version=' + version);
|
||||
$iframe.setButtons({});
|
||||
}
|
||||
}, {
|
||||
|
File diff suppressed because one or more lines are too long
@@ -243,6 +243,12 @@ var InputfieldTinyMCE = {
|
||||
'&hidpi=' + hidpi +
|
||||
'&file=' + src;
|
||||
|
||||
if(typeof ProcessWire.config.PagesVersions !== 'undefined') {
|
||||
if(ProcessWire.config.PagesVersions.page == $('#Inputfield_id').val()) {
|
||||
url += '&version=' + ProcessWire.config.PagesVersions.version;
|
||||
}
|
||||
}
|
||||
|
||||
t.log('Resizing image to width=' + width, url);
|
||||
|
||||
jQuery.getJSON(url, function(data) {
|
||||
|
@@ -126,6 +126,7 @@ function pwTinyMCE_image(editor) {
|
||||
var imagePageId = $('#page_id', $i).val();
|
||||
var hidpi = $("#selected_image_hidpi", $i).is(":checked") ? 1 : 0;
|
||||
var rotate = parseInt($("#selected_image_rotate", $i).val());
|
||||
var version = 0;
|
||||
|
||||
$iframe.dialog('disable');
|
||||
$iframe.setTitle(labels.savingImage); // Saving Image
|
||||
@@ -136,12 +137,19 @@ function pwTinyMCE_image(editor) {
|
||||
|
||||
file = file.substring(file.lastIndexOf('/')+1);
|
||||
|
||||
if(typeof ProcessWire.config.PagesVersions !== 'undefined') {
|
||||
if(ProcessWire.config.PagesVersions.page == imagePageId) {
|
||||
version = ProcessWire.config.PagesVersions.version;
|
||||
}
|
||||
}
|
||||
|
||||
var resizeUrl = modalUrl + 'resize' +
|
||||
'?id=' + imagePageId +
|
||||
'&file=' + file +
|
||||
'&width=' + width +
|
||||
'&height=' + height +
|
||||
'&hidpi=' + hidpi;
|
||||
'&hidpi=' + hidpi +
|
||||
'&version=' + version;
|
||||
|
||||
if(rotate) resizeUrl += '&rotate=' + rotate;
|
||||
|
||||
@@ -185,7 +193,13 @@ function pwTinyMCE_image(editor) {
|
||||
click: function() {
|
||||
var $i = $iframe.contents();
|
||||
var imagePageId = $('#page_id', $i).val();
|
||||
$iframe.attr('src', modalUrl + '?id=' + imagePageId + '&modal=1');
|
||||
var version = 0;
|
||||
if(typeof ProcessWire.config.PagesVersions !== 'undefined') {
|
||||
if(ProcessWire.config.PagesVersions.page == imagePageId) {
|
||||
version = ProcessWire.config.PagesVersions.version;
|
||||
}
|
||||
}
|
||||
$iframe.attr('src', modalUrl + '?id=' + imagePageId + '&modal=1&version=' + version);
|
||||
$iframe.setButtons({});
|
||||
}
|
||||
} ];
|
||||
@@ -282,6 +296,12 @@ function pwTinyMCE_image(editor) {
|
||||
|
||||
queryString += ('&winwidth=' + ($(window).width() - 30));
|
||||
|
||||
if(typeof ProcessWire.config.PagesVersions !== 'undefined') {
|
||||
if(ProcessWire.config.PagesVersions.page == pageId) {
|
||||
queryString += '&version=' + ProcessWire.config.PagesVersions.version;
|
||||
}
|
||||
}
|
||||
|
||||
return queryString;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user