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