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
|
||||
def javascripts(self):
|
||||
stylesheets = []
|
||||
scripts = []
|
||||
scripts_names = []
|
||||
|
||||
# Remove duplicate javascripts from the list
|
||||
for module in self.submodules:
|
||||
stylesheets.extend(getattr(module, "javascripts", []))
|
||||
return stylesheets
|
||||
module_scripts = getattr(module, "javascripts", [])
|
||||
for s in module_scripts:
|
||||
if s['name'] not in scripts_names:
|
||||
scripts.append(s)
|
||||
scripts_names.append(s['name'])
|
||||
|
||||
return scripts
|
||||
|
||||
@property
|
||||
def panels(self):
|
||||
|
@ -62,19 +62,6 @@ class BrowserModule(PgAdminModule):
|
||||
'exports': 'alertify',
|
||||
'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({
|
||||
'name': 'jqueryui.position',
|
||||
'path': url_for(
|
||||
|
@ -1,6 +1,6 @@
|
||||
define('pgadmin.browser',
|
||||
['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',
|
||||
'pgadmin.alertifyjs', 'pgadmin.browser.messages',
|
||||
'pgadmin.browser.menu', 'pgadmin.browser.panel',
|
||||
|
@ -4,7 +4,7 @@
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define([
|
||||
'underscore', 'underscore.string', 'jquery', 'backbone', 'backform',
|
||||
'backgrid', 'codemirror', 'pgadmin.backgrid', 'codemirror.sql',
|
||||
'backgrid', 'codemirror', 'pgadmin.backgrid', 'codemirror/mode/sql',
|
||||
'select2'
|
||||
],
|
||||
function(_, S, $, Backbone, Backform, Backgrid, CodeMirror) {
|
||||
|
@ -43,6 +43,11 @@
|
||||
require.config({
|
||||
baseUrl: '',
|
||||
waitSeconds: 0,
|
||||
packages: [{
|
||||
name: 'codemirror',
|
||||
location: '{{ url_for('static', filename='js/codemirror')}}',
|
||||
main: 'lib/codemirror'
|
||||
}],
|
||||
shim: {
|
||||
"backbone": {
|
||||
"deps": ['underscore', 'jquery'],
|
||||
|
Loading…
Reference in New Issue
Block a user