saby-customizer 0.0.0-pre.38 → 0.0.0-pre.39
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/lib/saby-lib/toolbar.js +23 -10
- package/package.json +1 -1
package/lib/saby-lib/toolbar.js
CHANGED
|
@@ -104,14 +104,25 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Добавляет в вертску сайта глобальный контейнер в панели для добавления кнопок
|
|
107
|
+
*
|
|
108
|
+
* @param {{searchCount:number}} options Опции регистарции обработчиков
|
|
107
109
|
*/
|
|
108
|
-
static addGlobalContainer() {
|
|
110
|
+
static addGlobalContainer({ searchCount } = { searchCount: 0 }) {
|
|
109
111
|
const sabyPageRightPanel = document.querySelector('.sabyPage-MainLayout__rightPanel .sabyPage-MainLayout__wrapper') ||
|
|
110
112
|
document.querySelector('.sabyPage-MainLayout__mainContent .sabyPage-widgets__rightPanel__bottomButtons .sabyPage-widgets__wrapper')
|
|
111
113
|
|
|
112
114
|
if (sabyPageRightPanel) {
|
|
113
115
|
ToolbarContainer.globalContainer = new ToolbarContainer({ global: true })
|
|
114
116
|
sabyPageRightPanel.prepend(ToolbarContainer.globalContainer)
|
|
117
|
+
} else {
|
|
118
|
+
if (searchCount < 10) {
|
|
119
|
+
searchCount++
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
this.addGlobalContainer({ searchCount })
|
|
122
|
+
}, 1000)
|
|
123
|
+
} else {
|
|
124
|
+
console.error('saby-customizer - addGlobalContainer: Не найден ни один общий контейнер для размещения доп. панелей с кнопками')
|
|
125
|
+
}
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
|
|
@@ -125,14 +136,16 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
125
136
|
const pageEntityContainer = document.querySelector('.onlinePage_Entity-wrapper.controls-Popup__dialog-target-container')
|
|
126
137
|
let timeout = null
|
|
127
138
|
|
|
128
|
-
this.observer
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
if (!this.observer) {
|
|
140
|
+
this.observer = new MutationObserver(() => {
|
|
141
|
+
if (!timeout) {
|
|
142
|
+
timeout = setTimeout(() => {
|
|
143
|
+
this.addTaskPanelContainer()
|
|
144
|
+
timeout = null
|
|
145
|
+
}, 1000)
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
}
|
|
136
149
|
|
|
137
150
|
if (popupContainer) {
|
|
138
151
|
this.observer.observe(popupContainer, { childList: true, subtree: true })
|
|
@@ -141,7 +154,7 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
141
154
|
this.observer.observe(pageEntityContainer, { childList: true, subtree: true })
|
|
142
155
|
}
|
|
143
156
|
if (!popupContainer && !pageEntityContainer) {
|
|
144
|
-
if (searchCount <
|
|
157
|
+
if (searchCount < 10) {
|
|
145
158
|
searchCount++
|
|
146
159
|
setTimeout(() => {
|
|
147
160
|
this.registerTaskPanelWatcher({ searchCount })
|