This commit is contained in:
yumoqing 2024-10-26 16:55:42 +08:00
parent b1682a6c5f
commit 0f544d4699

View File

@ -78,6 +78,7 @@ bricks.Toolbar = class extends bricks.Layout {
} }
remove_item(w, event){ remove_item(w, event){
this.bar.remove_widget(w); this.bar.remove_widget(w);
this.bar.unselect_item(w);
this.toolList.remove(w); this.toolList.remove(w);
w.unbind('click',this.do_handle.bind(this, w)); w.unbind('click',this.do_handle.bind(this, w));
this.dispatch('remove', w.tool_opts); this.dispatch('remove', w.tool_opts);
@ -92,6 +93,7 @@ bricks.Toolbar = class extends bricks.Layout {
if (this.opts.target){ if (this.opts.target){
d.target = this.opts.target; d.target = this.opts.target;
} }
this.bar.select_item(tool);
this.dispatch('command', d); this.dispatch('command', d);
this.dispatch(tool.tool_opts.name, d); this.dispatch(tool.tool_opts.name, d);
bricks.debug('event ', tool.tool_opts.name, ' fired ...') bricks.debug('event ', tool.tool_opts.name, ' fired ...')