saby-customizer 0.0.0-pre.29 → 0.0.0-pre.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/features/doc-copy-link.js +17 -0
- package/features/git-branch.js +5 -5
- package/lib/saby-lib/toolbar.js +14 -5
- package/package.json +1 -1
- package/userscript.js +2 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toolbar } from 'saby-customizer/lib.js'
|
|
2
|
+
import { octicons } from 'saby-customizer/octicons.js'
|
|
3
|
+
import { GitBranchCardData } from 'saby-customizer/features/git-branch.js'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
toolbar.addButton({
|
|
7
|
+
position: 'top',
|
|
8
|
+
title: 'Скопировать ссылку на карточку',
|
|
9
|
+
iconSVG: octicons.link.toSVG({ width: 18 }),
|
|
10
|
+
onclick: card => {
|
|
11
|
+
const gitCard = new GitBranchCardData(card.data)
|
|
12
|
+
|
|
13
|
+
gitCard.restoreFromHistory()
|
|
14
|
+
.then(() => gitCard.copyLink())
|
|
15
|
+
.catch(console.error)
|
|
16
|
+
}
|
|
17
|
+
})
|
package/features/git-branch.js
CHANGED
|
@@ -4,7 +4,7 @@ import { octicons } from 'saby-customizer/octicons.js'
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/** Класс для управления данными карточки задачи */
|
|
7
|
-
class GitBranchCardData {
|
|
7
|
+
export class GitBranchCardData {
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef GitCardData
|
|
@@ -595,12 +595,12 @@ toolbar.addButton({
|
|
|
595
595
|
position: 'top',
|
|
596
596
|
filter: { names: ['Ошибка', 'Задача'] },
|
|
597
597
|
title: 'Скопировать имя ветки для Git',
|
|
598
|
-
iconSVG: octicons['git-branch'].toSVG({ width:
|
|
598
|
+
iconSVG: octicons['git-branch'].toSVG({ width: 18 }),
|
|
599
599
|
onclick: card => {
|
|
600
600
|
const gitCard = new GitBranchCardData(card.data)
|
|
601
601
|
|
|
602
602
|
gitCard.restoreFromHistory()
|
|
603
|
-
.then(() => gitCard.copyBranchName()
|
|
603
|
+
.then(() => gitCard.copyBranchName())
|
|
604
604
|
.catch(console.error)
|
|
605
605
|
}
|
|
606
606
|
})
|
|
@@ -608,12 +608,12 @@ toolbar.addButton({
|
|
|
608
608
|
position: 'top',
|
|
609
609
|
filter: { names: ['Ошибка', 'Задача'] },
|
|
610
610
|
title: 'Скопировать описание для Git коммита',
|
|
611
|
-
iconSVG: octicons['git-commit'].toSVG({ width:
|
|
611
|
+
iconSVG: octicons['git-commit'].toSVG({ width: 18 }),
|
|
612
612
|
onclick: card => {
|
|
613
613
|
const gitCard = new GitBranchCardData(card.data)
|
|
614
614
|
|
|
615
615
|
gitCard.restoreFromHistory()
|
|
616
|
-
.then(() => gitCard.copyDescription()
|
|
616
|
+
.then(() => gitCard.copyDescription())
|
|
617
617
|
.catch(console.error)
|
|
618
618
|
}
|
|
619
619
|
})
|
package/lib/saby-lib/toolbar.js
CHANGED
|
@@ -23,10 +23,10 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
23
23
|
marginBottom: '6px'
|
|
24
24
|
},
|
|
25
25
|
'saby-customizer-toolbar.top': {
|
|
26
|
-
|
|
26
|
+
marginLeft: '16px'
|
|
27
27
|
},
|
|
28
28
|
'.button': {
|
|
29
|
-
padding: '
|
|
29
|
+
padding: '2px',
|
|
30
30
|
color: 'var(--secondary_icon-color)',
|
|
31
31
|
fill: 'var(--secondary_icon-color)',
|
|
32
32
|
cursor: 'pointer',
|
|
@@ -42,7 +42,10 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
42
42
|
'saby-customizer-toolbar.top .button': {
|
|
43
43
|
height: '20px',
|
|
44
44
|
width: '20px',
|
|
45
|
-
marginRight: '
|
|
45
|
+
marginRight: '8px'
|
|
46
|
+
},
|
|
47
|
+
'saby-customizer-toolbar.top .button:last-child': {
|
|
48
|
+
marginRight: '0'
|
|
46
49
|
},
|
|
47
50
|
'.button:hover': {
|
|
48
51
|
color: 'var(--link_hover_text-color)',
|
|
@@ -117,7 +120,7 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
117
120
|
|
|
118
121
|
if (popupContainer) {
|
|
119
122
|
this.observer = new MutationObserver(() => this.addTaskPanelContainer())
|
|
120
|
-
this.observer.observe(popupContainer, { childList: true })
|
|
123
|
+
this.observer.observe(popupContainer, { childList: true, subtree: true })
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
|
|
@@ -139,7 +142,13 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
if (topPanel) {
|
|
142
|
-
|
|
145
|
+
/** @type {ToolbarContainer} */
|
|
146
|
+
let topSidebar = topPanel.querySelector('saby-customizer-toolbar')
|
|
147
|
+
|
|
148
|
+
if (topSidebar && topSidebar.options?.card.data.number !== card.data.number) {
|
|
149
|
+
topSidebar.remove()
|
|
150
|
+
topSidebar = null
|
|
151
|
+
}
|
|
143
152
|
|
|
144
153
|
if (!topSidebar) {
|
|
145
154
|
topPanel.prepend(new ToolbarContainer({ card, position: 'top' }))
|
package/package.json
CHANGED
package/userscript.js
CHANGED
|
@@ -16,7 +16,8 @@ import { oom } from '@notml/core'
|
|
|
16
16
|
// Библиотеки компонентов плагина
|
|
17
17
|
// TODO: Перевести на опциональную загрузку
|
|
18
18
|
// await import('./lib/dashboard.js')
|
|
19
|
-
await import('
|
|
19
|
+
await import('saby-customizer/features/doc-copy-link.js')
|
|
20
|
+
await import('saby-customizer/features/git-branch.js')
|
|
20
21
|
|
|
21
22
|
// @font-face doesn't work with Shadow DOM https://github.com/mdn/interactive-examples/issues/887
|
|
22
23
|
// https://wiki.csswg.org/spec/css-scoping
|