kingkont 0.8.5 → 0.8.6

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/index.html CHANGED
@@ -240,7 +240,6 @@
240
240
  <button data-act="video">🎬 Сгенерировать видео</button>
241
241
  <hr style="margin:4px 0; border:0; border-top:1px solid #333;">
242
242
  <button data-act="save-template" title="Загрузить эту сцену как шаблон на сервер">💾 Сохранить сцену как шаблон</button>
243
- <button data-act="save-project-template" title="Загрузить весь проект (все сцены/персонажи/локации) как шаблон">💾 Сохранить проект как шаблон</button>
244
243
  </div>
245
244
 
246
245
  <!-- ===== Settings modal (двойной клик на сгенерированную ноду) ===== -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kingkont",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "KingKont · Chatium — нод-редактор сцен с AI-генерацией (картинки/видео/голос/SFX/музыка/текст)",
5
5
  "main": "main.js",
6
6
  "bin": {
package/renderer/board.js CHANGED
@@ -52,6 +52,12 @@ window.addEventListener('DOMContentLoaded', async () => {
52
52
  $('openTemplates')?.addEventListener('click', () => {
53
53
  if (typeof openTemplatesWindow === 'function') openTemplatesWindow();
54
54
  });
55
+ // ПКМ на 📚 — действия над всем проектом (сохранение проекта как шаблон).
56
+ $('openTemplates')?.addEventListener('contextmenu', e => {
57
+ e.preventDefault();
58
+ e.stopPropagation();
59
+ showTemplatesButtonContextMenu(e.clientX, e.clientY);
60
+ });
55
61
  // Sidebar search — фильтрует персонажей/локации/сцены.
56
62
  $('sidebarSearch').addEventListener('input', e => {
57
63
  const q = e.target.value.trim().toLowerCase();
@@ -1986,6 +1992,31 @@ function showNodeContextMenu(node, clientX, clientY) {
1986
1992
  setTimeout(() => document.addEventListener('mousedown', closeNodeMenu, { once: true }), 0);
1987
1993
  }
1988
1994
 
1995
+ // ПКМ на 📚 Templates-кнопке — действия проектного уровня.
1996
+ function showTemplatesButtonContextMenu(clientX, clientY) {
1997
+ const menu = $('nodeMenu');
1998
+ menu.innerHTML = '';
1999
+ const add = (label, fn, opts = {}) => {
2000
+ const b = document.createElement('button');
2001
+ b.textContent = label;
2002
+ if (opts.disabled) { b.disabled = true; b.style.opacity = '0.4'; b.style.cursor = 'default'; }
2003
+ b.addEventListener('click', () => {
2004
+ if (b.disabled) return;
2005
+ menu.classList.add('hidden');
2006
+ fn();
2007
+ });
2008
+ menu.appendChild(b);
2009
+ };
2010
+ add('📂 Открыть библиотеку шаблонов', () => {
2011
+ if (typeof openTemplatesWindow === 'function') openTemplatesWindow();
2012
+ });
2013
+ add('💾 Сохранить проект как шаблон', () => {
2014
+ if (typeof saveCurrentProjectAsTemplate === 'function') saveCurrentProjectAsTemplate();
2015
+ }, { disabled: !state.filmHandle });
2016
+ positionFloatingMenu(menu, clientX, clientY);
2017
+ setTimeout(() => document.addEventListener('mousedown', closeNodeMenu, { once: true }), 0);
2018
+ }
2019
+
1989
2020
  function closeNodeMenu(e) {
1990
2021
  // Клик по активной кнопке меню — даём её click-обработчику сработать (он сам закроет меню),
1991
2022
  // а пока перевзводим listener, чтобы случайно не закрыть до click-а.
@@ -168,14 +168,8 @@ document.querySelectorAll('#addMenu button').forEach(btn => {
168
168
  }
169
169
  return;
170
170
  }
171
- if (act === 'save-project-template') {
172
- // Сохранение ВСЕГО проекта (все boards) как одного шаблона.
173
- state.addMenuPos = null;
174
- if (typeof saveCurrentProjectAsTemplate === 'function') {
175
- await saveCurrentProjectAsTemplate();
176
- }
177
- return;
178
- }
171
+ // save-project-template вынесен на ПКМ 📚 Templates-кнопки
172
+ // (см. board.js: showTemplatesButtonContextMenu).
179
173
  if (act === 'gen-text') {
180
174
  // открываем text-gen modal; если есть fromNode — подставляем @ref в промпт
181
175
  if (!await ensureApiKey('text')) return;