miton18 miton18 - 11 months ago 73
CoffeeScript Question

My brackets bottom panel doesn't work

I try to do a Brackets extension ( the web editor ), and I have to create a bottom panel, but it never appear,
the show method do nothing and setVisible too,
can you tell me why? Thx...

define (require, exports, module)->
log = (s)->
console.log "%c[SQL-DISPLAY] " + s, "color:#f4aa05;font-size:large"
log "started..."
commandManager = brackets.getModule "command/CommandManager"
menus = brackets.getModule "command/Menus"
appInit = brackets.getModule "utils/AppInit"
dialogs = brackets.getModule "widgets/Dialogs"
defaultDialogs = brackets.getModule "widgets/DefaultDialogs"
workspaceManager = brackets.getModule "view/WorkspaceManager"

sql_display_execute = 'sql-display.execute' # mon entrée dans le menu
panel = {}

appInit.appReady ()->
commandManager.register 'sql-display panel', sql_display_execute, handleSqlDisplay
menu = menus.getMenu menus.AppMenuBar.VIEW_MENU
menu.addMenuItem sql_display_execute

panel = workspaceManager.createBottomPanel 'sql.display.execute', $(require('text!templates/panel.html')), 400

handleSqlDisplay = ()->

log "disp modal box"
console.log panel

console.log panel.isVisible() #always false
# affiche une modal
#dialogs.showModalDialog defaultDialogs.DIALOG_ID_INFO, "database informations", "<p>test</p>"
if panel.isVisible()
console.log 'try to show'

while( !panel.isVisible)

console.log panel.isVisible()#always false

Answer Source

OK I solve my problem, a bottom cannot open if you don't load a stylesheet ^^

extensionUtils = brackets.getModule "utils/ExtensionUtils"
extensionUtils.loadStyleSheet(module, "main.css");

with this, it's work...