|
|
|
@ -1,8 +1,8 @@
|
|
|
|
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
|
|
|
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
|
|
|
|
|
|
|
|
|
|
|
const TPL = `<span class="button-widget icon-action bx"
|
|
|
|
const TPL = `<button class="button-widget no-print" data-toggle="tooltip">
|
|
|
|
data-toggle="tooltip"
|
|
|
|
<span class="bx"></span>
|
|
|
|
title=""></span>`;
|
|
|
|
</button>`;
|
|
|
|
|
|
|
|
|
|
|
|
export default class AbstractButtonWidget extends NoteContextAwareWidget {
|
|
|
|
export default class AbstractButtonWidget extends NoteContextAwareWidget {
|
|
|
|
isEnabled() {
|
|
|
|
isEnabled() {
|
|
|
|
@ -22,6 +22,7 @@ export default class AbstractButtonWidget extends NoteContextAwareWidget {
|
|
|
|
|
|
|
|
|
|
|
|
doRender() {
|
|
|
|
doRender() {
|
|
|
|
this.$widget = $(TPL);
|
|
|
|
this.$widget = $(TPL);
|
|
|
|
|
|
|
|
this.$iconSpan = this.$widget.find("span");
|
|
|
|
|
|
|
|
|
|
|
|
if (this.settings.onContextMenu) {
|
|
|
|
if (this.settings.onContextMenu) {
|
|
|
|
this.$widget.on("contextmenu", e => {
|
|
|
|
this.$widget.on("contextmenu", e => {
|
|
|
|
@ -49,9 +50,9 @@ export default class AbstractButtonWidget extends NoteContextAwareWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
refreshIcon() {
|
|
|
|
refreshIcon() {
|
|
|
|
for (const className of this.$widget[0].classList) {
|
|
|
|
for (const className of this.$iconSpan[0].classList) {
|
|
|
|
if (className.startsWith("bx-")) {
|
|
|
|
if (className.startsWith("bx-")) {
|
|
|
|
this.$widget.removeClass(className);
|
|
|
|
this.$iconSpan.removeClass(className);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,7 +60,7 @@ export default class AbstractButtonWidget extends NoteContextAwareWidget {
|
|
|
|
? this.settings.icon()
|
|
|
|
? this.settings.icon()
|
|
|
|
: this.settings.icon;
|
|
|
|
: this.settings.icon;
|
|
|
|
|
|
|
|
|
|
|
|
this.$widget.addClass(icon);
|
|
|
|
this.$iconSpan.addClass(icon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
initialRenderCompleteEvent() {
|
|
|
|
initialRenderCompleteEvent() {
|
|
|
|
@ -87,4 +88,4 @@ export default class AbstractButtonWidget extends NoteContextAwareWidget {
|
|
|
|
onContextMenu(handler) {
|
|
|
|
onContextMenu(handler) {
|
|
|
|
this.settings.onContextMenu = handler;
|
|
|
|
this.settings.onContextMenu = handler;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|