saby-customizer 0.0.0-pre.36 → 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 +38 -11
- package/package.json +1 -1
package/lib/saby-lib/toolbar.js
CHANGED
|
@@ -104,31 +104,48 @@ 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
|
|
|
118
|
-
/**
|
|
119
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Регистрирует обработчик для поиска открытых задач и добавления в них панели
|
|
131
|
+
*
|
|
132
|
+
* @param {{searchCount:number}} options Опции регистарции обработчиков
|
|
133
|
+
*/
|
|
134
|
+
static registerTaskPanelWatcher({ searchCount } = { searchCount: 0 }) {
|
|
120
135
|
const popupContainer = document.getElementById('popup')
|
|
121
136
|
const pageEntityContainer = document.querySelector('.onlinePage_Entity-wrapper.controls-Popup__dialog-target-container')
|
|
122
137
|
let timeout = null
|
|
123
138
|
|
|
124
|
-
this.observer
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
+
}
|
|
132
149
|
|
|
133
150
|
if (popupContainer) {
|
|
134
151
|
this.observer.observe(popupContainer, { childList: true, subtree: true })
|
|
@@ -136,6 +153,16 @@ class ToolbarContainer extends oom.extends(HTMLElement, optionsDefaults) {
|
|
|
136
153
|
if (pageEntityContainer) {
|
|
137
154
|
this.observer.observe(pageEntityContainer, { childList: true, subtree: true })
|
|
138
155
|
}
|
|
156
|
+
if (!popupContainer && !pageEntityContainer) {
|
|
157
|
+
if (searchCount < 10) {
|
|
158
|
+
searchCount++
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
this.registerTaskPanelWatcher({ searchCount })
|
|
161
|
+
}, 1000)
|
|
162
|
+
} else {
|
|
163
|
+
console.error('saby-customizer - registerTaskPanelWatcher: Не найден ни один общий контейнер для размещения доп. панелей с кнопками')
|
|
164
|
+
}
|
|
165
|
+
}
|
|
139
166
|
}
|
|
140
167
|
|
|
141
168
|
/** Добавления во все найденные открытые задачи правую панель */
|