Skip to content

Commit

Permalink
fix: 修復 summernote-custom-style, summernote-imagemap dialog 按鈕的 toolt…
Browse files Browse the repository at this point in the history
…ip 插入位置

設定 tooltip 的 container 為所在的 dialog

Signed-off-by: wyttime04 <vanessa80332@gmail.com>
  • Loading branch information
wyttime04 committed Jan 29, 2024
1 parent 1c78b4b commit 1899df1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/plugin/custom/summernote-custom-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,10 @@
$('<div class="note-btn-group btn-group">').append(fontStyleBtns).appendTo($customStyleToolbar)
$('<div class="note-btn-group btn-group">').append($forecolorBtn, $backcolorBtn).appendTo($customStyleToolbar)

var $container = options.dialogsInBody ? $(document.body) : $editor
$customStyleToolbar.find('button.note-btn,button.note-color-btn').each((_, domBtn) => {
let $btn = $(domBtn)
$btn.tooltip('dispose').tooltip({
container: $container,
container: this.$dialog,
trigger: 'hover',
placement: 'bottom',
})
Expand Down
14 changes: 7 additions & 7 deletions src/plugin/custom/summernote-imagemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
$targetImgMap,
$imgMapEditor,
$imgMapToolbar,
this.$dialog,
)

ui.onDialogShown(this.$dialog, () => {
Expand Down Expand Up @@ -322,11 +323,12 @@
}

class EditImageMap extends ImageMap {
constructor(id, $img, $map, $editor, $toolbar) {
constructor(id, $img, $map, $editor, $toolbar, $container) {
super(id, $img, $map)

this.$editor = $editor
this.$toolbar = $toolbar
this.$container = $container || document.body
}

init() {
Expand All @@ -346,7 +348,6 @@
* Initial Toolbar
*/
initToolbar() {
var $container = options.dialogsInBody ? $(document.body) : $editor
let rectIcon = `<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<rect stroke="#000000" fill="none" id="svg_1" height="8.68468" width="13.59878" y="5.60704" x="3.16221"/>
<ellipse stroke="#000000" ry="1.75858" rx="1.75858" id="svg_4" cy="5.64647" cx="3.25446" fill="#ffffff"/>
Expand All @@ -358,15 +359,15 @@
let $rectBtn = ui.button({
contents: `<i class="note-icon">${rectIcon}</i>`,
tooltip: lang.imageMap.rect,
container: $container
container: this.$container
}).render()
.appendTo(this.$toolbar)
.wrap('<div class="note-btn-group btn-group">')

this.$deletBtn = ui.button({
contents: `<i class="note-icon-trash">`,
tooltip: lang.imageMap.delete,
container: $container
container: this.$container
}).render()
.prop('disabled', true)
.appendTo(this.$toolbar)
Expand Down Expand Up @@ -487,7 +488,6 @@
this.$activeElement.siblings('text').text(this.$title.val())
})

var $container = options.dialogsInBody ? $(document.body) : $editor
var $toggle = $('<div>').addClass(['note-btn-group', 'togglebtn', 'show'])
.appendTo($attr)
.append(
Expand All @@ -499,7 +499,7 @@
toggle: "collapse",
target: `#attr-collapse-${this.id}`,
},
container: $container
container: this.$container
}).render()
)
.append(
Expand All @@ -511,7 +511,7 @@
toggle: "collapse",
target: `#attr-collapse-${this.id}`,
},
container: $container
container: this.$container
}).render()
)

Expand Down

0 comments on commit 1899df1

Please sign in to comment.