Whitelist RTE.js in modular code and add some related function for sliding messages in show_ajax_messages.js.

Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
This commit is contained in:
Piyush Vijay 2018-09-20 04:38:09 +05:30
parent 12781a3f97
commit 074c5063ab
No known key found for this signature in database
GPG Key ID: FC77A75558658D35
4 changed files with 97 additions and 4 deletions

View File

@ -17,7 +17,8 @@ const PhpToJsFileMapping = {
'indexes',
'key_handler',
'cross_framing_protection',
'drag_drop_import'
'drag_drop_import',
'rte'
],
server_privileges: ['server_privileges'],
server_databases: ['server_databases'],
@ -100,7 +101,8 @@ const JsFileList = [
'key_handler',
'cross_framing_protection',
'drag_drop_import',
'normalization'
'normalization',
'rte'
];
export {

View File

@ -1,10 +1,13 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/* Module import */
import * as Navigation from './functions/navigation';
import { PMA_Messages as PMA_messages } from './variables/export_variables';
import CommonParams from './variables/common_params';
import { PMA_ajaxShowMessage, PMA_ajaxRemoveMessage, PMA_tooltip } from './utils/show_ajax_messages';
import { isStorageSupported } from './functions/config';
import { indexEditorDialog } from './functions/Indexes';
import RTE from './classes/RTE';
/**
* function used in or for navigation panel

View File

@ -220,11 +220,99 @@ function PMA_ajaxRemoveMessage ($thisMsgbox) {
}
}
/**
* Creates a message inside an object with a sliding effect
*
* @param msg A string containing the text to display
* @param $obj a jQuery object containing the reference
* to the element where to put the message
* This is optional, if no element is
* provided, one will be created below the
* navigation links at the top of the page
*
* @return bool True on success, false on failure
*/
function PMA_slidingMessage (msg, $obj) {
if (msg === undefined || msg.length === 0) {
// Don't show an empty message
return false;
}
if ($obj === undefined || !($obj instanceof jQuery) || $obj.length === 0) {
// If the second argument was not supplied,
// we might have to create a new DOM node.
if ($('#PMA_slidingMessage').length === 0) {
$('#page_content').prepend(
'<span id="PMA_slidingMessage" ' +
'class="pma_sliding_message"></span>'
);
}
$obj = $('#PMA_slidingMessage');
}
if ($obj.has('div').length > 0) {
// If there already is a message inside the
// target object, we must get rid of it
$obj
.find('div')
.first()
.fadeOut(function () {
$obj
.children()
.remove();
$obj
.append('<div>' + msg + '</div>');
// highlight any sql before taking height;
PMA_highlightSQL($obj);
$obj.find('div')
.first()
.hide();
$obj
.animate({
height: $obj.find('div').first().height()
})
.find('div')
.first()
.fadeIn();
});
} else {
// Object does not already have a message
// inside it, so we simply slide it down
$obj.width('100%')
.html('<div>' + msg + '</div>');
// highlight any sql before taking height;
PMA_highlightSQL($obj);
var h = $obj
.find('div')
.first()
.hide()
.height();
$obj
.find('div')
.first()
.css('height', 0)
.show()
.animate({
height: h
}, function () {
// Set the height of the parent
// to the height of the child
$obj
.height(
$obj
.find('div')
.first()
.height()
);
});
}
return true;
} // end PMA_slidingMessage()
/**
* Module export
*/
export {
PMA_ajaxRemoveMessage,
PMA_ajaxShowMessage,
PMA_tooltip
PMA_tooltip,
PMA_slidingMessage
};

View File

@ -189,7 +189,7 @@ class Header
if ($GLOBALS['cfg']['AllowThirdPartyFraming'] === false) {
$this->_scripts->addFile('cross_framing_protection');
}
$this->_scripts->addFile('rte.js');
$this->_scripts->addFile('rte');
if ($GLOBALS['cfg']['SendErrorReports'] !== 'never') {
$this->_scripts->addFile('vendor/tracekit.js');
$this->_scripts->addFile('error_report.js');