mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Load the codemirror as package in the require.js, which will allow us to
load the codemirror addons without any modification.
This commit is contained in:
parent
af1e38a97a
commit
30d189f499
@ -61,10 +61,18 @@ class PgAdmin(Flask):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def javascripts(self):
|
def javascripts(self):
|
||||||
stylesheets = []
|
scripts = []
|
||||||
|
scripts_names = []
|
||||||
|
|
||||||
|
# Remove duplicate javascripts from the list
|
||||||
for module in self.submodules:
|
for module in self.submodules:
|
||||||
stylesheets.extend(getattr(module, "javascripts", []))
|
module_scripts = getattr(module, "javascripts", [])
|
||||||
return stylesheets
|
for s in module_scripts:
|
||||||
|
if s['name'] not in scripts_names:
|
||||||
|
scripts.append(s)
|
||||||
|
scripts_names.append(s['name'])
|
||||||
|
|
||||||
|
return scripts
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def panels(self):
|
def panels(self):
|
||||||
|
@ -62,19 +62,6 @@ class BrowserModule(PgAdminModule):
|
|||||||
'exports': 'alertify',
|
'exports': 'alertify',
|
||||||
'preloaded': True
|
'preloaded': True
|
||||||
})
|
})
|
||||||
scripts.append({
|
|
||||||
'name': 'codemirror',
|
|
||||||
'path': url_for('static', filename='js/codemirror/codemirror'),
|
|
||||||
'exports': 'CodeMirror',
|
|
||||||
'preloaded': True
|
|
||||||
})
|
|
||||||
scripts.append({
|
|
||||||
'name': 'codemirror.sql',
|
|
||||||
'path': url_for('static', filename='js/codemirror/mode/sql'),
|
|
||||||
'deps': ['codemirror'],
|
|
||||||
'exports': 'CodeMirror.modes.sql',
|
|
||||||
'preloaded': True
|
|
||||||
})
|
|
||||||
scripts.append({
|
scripts.append({
|
||||||
'name': 'jqueryui.position',
|
'name': 'jqueryui.position',
|
||||||
'path': url_for(
|
'path': url_for(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
define('pgadmin.browser',
|
define('pgadmin.browser',
|
||||||
['require', 'jquery', 'underscore', 'underscore.string', 'bootstrap',
|
['require', 'jquery', 'underscore', 'underscore.string', 'bootstrap',
|
||||||
'pgadmin', 'alertify', 'codemirror', 'codemirror.sql', 'wcdocker',
|
'pgadmin', 'alertify', 'codemirror', 'codemirror/mode/sql', 'wcdocker',
|
||||||
'jquery.contextmenu', 'jquery.aciplugin', 'jquery.acitree',
|
'jquery.contextmenu', 'jquery.aciplugin', 'jquery.acitree',
|
||||||
'pgadmin.alertifyjs', 'pgadmin.browser.messages',
|
'pgadmin.alertifyjs', 'pgadmin.browser.messages',
|
||||||
'pgadmin.browser.menu', 'pgadmin.browser.panel',
|
'pgadmin.browser.menu', 'pgadmin.browser.panel',
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define([
|
define([
|
||||||
'underscore', 'underscore.string', 'jquery', 'backbone', 'backform',
|
'underscore', 'underscore.string', 'jquery', 'backbone', 'backform',
|
||||||
'backgrid', 'codemirror', 'pgadmin.backgrid', 'codemirror.sql',
|
'backgrid', 'codemirror', 'pgadmin.backgrid', 'codemirror/mode/sql',
|
||||||
'select2'
|
'select2'
|
||||||
],
|
],
|
||||||
function(_, S, $, Backbone, Backform, Backgrid, CodeMirror) {
|
function(_, S, $, Backbone, Backform, Backgrid, CodeMirror) {
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
require.config({
|
require.config({
|
||||||
baseUrl: '',
|
baseUrl: '',
|
||||||
waitSeconds: 0,
|
waitSeconds: 0,
|
||||||
|
packages: [{
|
||||||
|
name: 'codemirror',
|
||||||
|
location: '{{ url_for('static', filename='js/codemirror')}}',
|
||||||
|
main: 'lib/codemirror'
|
||||||
|
}],
|
||||||
shim: {
|
shim: {
|
||||||
"backbone": {
|
"backbone": {
|
||||||
"deps": ['underscore', 'jquery'],
|
"deps": ['underscore', 'jquery'],
|
||||||
|
Loading…
Reference in New Issue
Block a user