Фаза 5: панель форматирования — FormatToolbar/TbButton, JS-форматирование в EditorPane (инлайн/списки/задачи/заголовки/цвета/индексы/цитата/выноска/обтекание), TableEditor (2×1, полосы «+» 20px)
This commit is contained in:
@@ -103,6 +103,18 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Панель форматирования (Фаза 5) -----
|
||||
FormatToolbar {
|
||||
id: formatToolbar
|
||||
Layout.fillWidth: true
|
||||
visible: documentManager.activeIndex >= 0 && toolbarShouldShow()
|
||||
targetPane: activePane()
|
||||
onTableRequested: {
|
||||
tableEditor.resetDialog()
|
||||
tableEditor.open()
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Область редактора (одна или две панели) -----
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
@@ -143,6 +155,35 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Функции активной панели и таблица -----
|
||||
function activePane() {
|
||||
if (secondaryPane.visible && secondaryPane.hasFocus)
|
||||
return secondaryPane
|
||||
return primaryPane
|
||||
}
|
||||
function toolbarShouldShow() {
|
||||
const p = primaryPane
|
||||
const s = secondaryPane
|
||||
return (p.hasFocus && p.editMode)
|
||||
|| (s.visible && s.hasFocus && s.editMode)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: primaryPane
|
||||
function onActiveFocusChanged() { formatToolbar.targetPane = root.activePane() }
|
||||
}
|
||||
Connections {
|
||||
target: secondaryPane
|
||||
function onActiveFocusChanged() { formatToolbar.targetPane = root.activePane() }
|
||||
}
|
||||
|
||||
TableEditor {
|
||||
id: tableEditor
|
||||
onMarkdownReady: (md) => {
|
||||
root.activePane().insertText(md)
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Горячие клавиши -----
|
||||
Shortcut {
|
||||
sequence: "Ctrl+S"
|
||||
|
||||
Reference in New Issue
Block a user