From 2adf09129dddd4df231d18b4198fb2a9663fdf5c Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 22 Apr 2016 08:36:29 +0100 Subject: [PATCH] Introduce text editor toolbar (#2315) Tada! --- core/images/auto-height.tid | 6 - core/images/bold.tid | 8 - core/images/erase.tid | 8 - core/images/excise.tid | 8 - core/images/fixed-height.tid | 8 - core/images/heading-1.tid | 8 - core/images/heading-2.tid | 8 - core/images/heading-3.tid | 8 - core/images/heading-4.tid | 8 - core/images/heading-5.tid | 8 - core/images/heading-6.tid | 8 - core/images/italic.tid | 8 - core/images/line-width.tid | 9 - core/images/list-bullet.tid | 8 - core/images/list-number.tid | 8 - core/images/mono-block.tid | 8 - core/images/mono-line.tid | 8 - core/images/new-image-button.tid | 8 - core/images/opacity.tid | 10 - core/images/paint.tid | 8 - core/images/picture.tid | 8 - core/images/preview-closed.tid | 15 - core/images/preview-open.tid | 9 - core/images/quote.tid | 8 - core/images/redo.tid | 11 - core/images/size.tid | 6 - core/images/stamp.tid | 8 - core/images/strikethrough.tid | 9 - core/images/subscript.tid | 8 - core/images/superscript.tid | 8 - core/images/underline.tid | 8 - core/images/undo.tid | 8 - core/language/en-GB/Buttons.multids | 82 +++++ core/language/en-GB/ControlPanel.multids | 15 + core/language/en-GB/EditTemplate.multids | 4 - core/language/en-GB/GettingStarted.tid | 2 +- core/language/en-GB/Misc.multids | 1 + core/language/en-GB/Snippets/ListByTag.tid | 6 + .../en-GB/Snippets/MacroDefinition.tid | 8 + core/language/en-GB/Snippets/Table 4x3.tid | 9 + .../en-GB/Snippets/TableOfContents.tid | 10 + core/modules/editor/engines/framed.js | 211 ++++++++++++ core/modules/editor/engines/simple.js | 153 +++++++++ core/modules/editor/factory.js | 309 ++++++++++++++++++ .../modules/editor/operations/bitmap/clear.js | 24 ++ .../editor/operations/bitmap/resize.js | 29 ++ core/modules/editor/operations/text/excise.js | 49 +++ .../editor/operations/text/prefix-lines.js | 59 ++++ core/modules/editor/operations/text/redo.js | 19 ++ .../editor/operations/text/replace-all.js | 23 ++ .../operations/text/replace-selection.js | 23 ++ core/modules/editor/operations/text/undo.js | 19 ++ .../editor/operations/text/wrap-lines.js | 28 ++ .../editor/operations/text/wrap-selection.js | 52 +++ core/modules/keyboard.js | 279 ++++++++++++++++ core/modules/macros/displayshortcuts.js | 45 +++ core/modules/startup/startup.js | 26 ++ core/modules/utils/dom/dom.js | 64 ++++ core/modules/utils/dom/keyboard.js | 64 +--- core/modules/utils/utils.js | 33 ++ core/modules/widgets/edit-bitmap.js | 117 +++---- core/modules/widgets/edit-shortcut.js | 139 ++++++++ core/modules/widgets/edit-text.js | 278 +--------------- core/modules/widgets/edit.js | 3 +- core/modules/widgets/entity.js | 11 +- core/modules/widgets/keyboard.js | 4 +- core/modules/widgets/wikify.js | 154 +++++++++ core/ui/ControlPanel/Basics.tid | 2 +- core/ui/ControlPanel/KeyboardShortcuts.tid | 140 ++++++++ .../ControlPanel/Toolbars/EditorToolbar.tid | 21 ++ core/ui/EditTemplate.tid | 4 +- core/ui/EditTemplate/body-editor.tid | 11 + core/ui/EditTemplate/body-toolbar-button.tid | 47 +++ core/ui/EditTemplate/body.tid | 23 +- core/ui/EditorToolbar/bold.tid | 14 + core/ui/EditorToolbar/clear-dropdown.tid | 21 ++ core/ui/EditorToolbar/clear.tid | 8 + .../EditorToolbar/editor-height-dropdown.tid | 8 + core/ui/EditorToolbar/editor-height.tid | 15 + core/ui/EditorToolbar/excise-dropdown.tid | 45 +++ core/ui/EditorToolbar/excise.tid | 9 + core/ui/EditorToolbar/heading-1.tid | 14 + core/ui/EditorToolbar/heading-2.tid | 14 + core/ui/EditorToolbar/heading-3.tid | 14 + core/ui/EditorToolbar/heading-4.tid | 14 + core/ui/EditorToolbar/heading-5.tid | 14 + core/ui/EditorToolbar/heading-6.tid | 14 + core/ui/EditorToolbar/italic.tid | 14 + core/ui/EditorToolbar/line-width-dropdown.tid | 42 +++ core/ui/EditorToolbar/line-width.tid | 9 + core/ui/EditorToolbar/list-bullet.tid | 14 + core/ui/EditorToolbar/list-number.tid | 14 + core/ui/EditorToolbar/mono-block.tid | 15 + core/ui/EditorToolbar/mono-line.tid | 14 + core/ui/EditorToolbar/more-dropdown.tid | 19 ++ core/ui/EditorToolbar/more.tid | 8 + core/ui/EditorToolbar/opacity-dropdown.tid | 54 +++ core/ui/EditorToolbar/opacity.tid | 9 + core/ui/EditorToolbar/paint-dropdown.tid | 16 + core/ui/EditorToolbar/paint.tid | 14 + core/ui/EditorToolbar/picture-dropdown.tid | 21 ++ core/ui/EditorToolbar/picture.tid | 9 + .../EditorToolbar/preview-type-dropdown.tid | 33 ++ core/ui/EditorToolbar/preview-type.tid | 8 + core/ui/EditorToolbar/preview.tid | 17 + core/ui/EditorToolbar/quote.tid | 15 + core/ui/EditorToolbar/redo.tid | 11 + core/ui/EditorToolbar/size-dropdown.tid | 75 +++++ core/ui/EditorToolbar/size.tid | 8 + core/ui/EditorToolbar/stamp-dropdown.tid | 53 +++ core/ui/EditorToolbar/stamp.tid | 9 + core/ui/EditorToolbar/strikethrough.tid | 14 + core/ui/EditorToolbar/subscript.tid | 14 + core/ui/EditorToolbar/superscript.tid | 14 + core/ui/EditorToolbar/underline.tid | 14 + core/ui/EditorToolbar/undo.tid | 11 + core/ui/PageControls/new-image.tid | 14 + core/wiki/config/BitmapEditorColour.tid | 2 +- core/wiki/config/BitmapEditorImageSizes.tid | 3 + core/wiki/config/BitmapEditorLineWidth.tid | 2 +- core/wiki/config/BitmapEditorLineWidths.tid | 3 + core/wiki/config/BitmapEditorOpacities.tid | 3 + core/wiki/config/BitmapEditorOpacity.tid | 3 + core/wiki/config/EditorToolbarButtons.multids | 5 + core/wiki/config/PageControlButtons.multids | 1 + core/wiki/config/ShortcutInfo.multids | 25 ++ .../config/TextEditorEditorHeightHeight.tid | 3 + .../config/TextEditorEditorHeightMode.tid | 3 + .../config/shortcuts/cancel-edit-tiddler.tid | 3 - core/wiki/config/shortcuts/save-tiddler.tid | 3 - .../config/shortcuts/shortcuts-linux.multids | 2 + .../config/shortcuts/shortcuts-mac.multids | 5 + .../shortcuts/shortcuts-not-linux.multids | 2 + .../shortcuts/shortcuts-not-mac.multids | 5 + .../shortcuts/shortcuts-not-windows.multids | 2 + .../shortcuts/shortcuts-windows.multids | 2 + core/wiki/config/shortcuts/shortcuts.multids | 22 ++ core/wiki/macros/colour-picker.tid | 55 ++++ core/wiki/macros/image-picker.tid | 26 ++ core/wiki/macros/translink.tid | 15 + core/wiki/tags/EditorToolbar.tid | 2 + core/wiki/tags/PageControls.tid | 2 +- editions/prerelease/tiddlywiki.info | 3 +- editions/translators/tiddlywiki.info | 1 + .../Hidden_Setting__Keyboard_Shortcuts.tid | 11 - .../tiddlers/howtos/KeyboardShortcuts.tid | 12 +- .../tiddlers/macros/colour-picker_Macro.tid | 15 + .../colour-picker_Macro_(Example_1).tid | 15 + .../colour-picker_Macro_(Examples).tid | 7 + .../image-picker_Macro_(Example_1).tid | 17 + .../image-picker_Macro_(Examples).tid | 7 + .../tiddlers/macros/image-picker_Macro.tid | 15 + .../tiddlers/releasenotes}/Release 5.1.12.tid | 39 ++- editions/tw5.com/tiddlers/roadmap/RoadMap.tid | 21 +- .../tw5.com/tiddlers/widgets/EntityWidget.tid | 17 + .../tiddlers/widgets/KeyboardWidget.tid | 10 +- .../tw5.com/tiddlers/widgets/WikifyWidget.tid | 28 ++ languages/ca-ES/EditTemplate.multids | 3 - languages/cs-CZ/EditTemplate.multids | 3 - languages/da-DK/EditTemplate.multids | 3 - languages/de-DE/EditTemplate.multids | 4 +- languages/el-GR/EditTemplate.multids | 3 - languages/es-ES/EditTemplate.multids | 3 - languages/fr-FR/Buttons.multids | 81 +++++ languages/fr-FR/ControlPanel.multids | 21 ++ languages/fr-FR/EditTemplate.multids | 4 +- languages/fr-FR/Snippets/ListByTag.tid | 6 + languages/fr-FR/Snippets/Table 4x3.tid | 9 + languages/fr-FR/Snippets/TableOfContents.tid | 10 + languages/hi-IN/EditTemplate.multids | 3 - languages/ia-IA/EditTemplate.multids | 3 - languages/it-IT/EditTemplate.multids | 3 - languages/ja-JP/EditTemplate.multids | 3 - languages/ko-KR/EditTemplate.multids | 3 - languages/nl-NL/EditTemplate.multids | 3 - languages/pa-IN/EditTemplate.multids | 3 - languages/pt-PT/EditTemplate.multids | 3 - languages/ru-RU/EditTemplate.multids | 3 - languages/sk-SK/EditTemplate.multids | 3 - languages/sv-SE/EditTemplate.multids | 3 - languages/zh-Hans/Buttons.multids | 81 +++++ languages/zh-Hans/ControlPanel.multids | 15 + languages/zh-Hans/EditTemplate.multids | 4 - languages/zh-Hans/GettingStarted.tid | 2 +- languages/zh-Hans/Misc.multids | 1 + languages/zh-Hans/Snippets/ListByTag.tid | 6 + .../zh-Hans/Snippets/MacroDefinition.tid | 8 + languages/zh-Hans/Snippets/Table 4x3.tid | 9 + .../zh-Hans/Snippets/TableOfContents.tid | 10 + languages/zh-Hant/Buttons.multids | 81 +++++ languages/zh-Hant/ControlPanel.multids | 15 + languages/zh-Hant/EditTemplate.multids | 4 - languages/zh-Hant/GettingStarted.tid | 2 +- languages/zh-Hant/Misc.multids | 1 + languages/zh-Hant/Snippets/ListByTag.tid | 6 + .../zh-Hant/Snippets/MacroDefinition.tid | 8 + languages/zh-Hant/Snippets/Table 4x3.tid | 9 + .../zh-Hant/Snippets/TableOfContents.tid | 10 + .../codemirror/EditorTypeMappings.multids | 0 .../tiddlywiki/codemirror/edit-codemirror.js | 0 .../codemirror/files/addon/dialog/dialog.css | 0 .../codemirror/files/addon/dialog/dialog.js | 0 .../files/addon/edit/matchbrackets.js | 0 .../files/addon/search/searchcursor.js | 0 .../codemirror/files/codemirror.css | 0 .../tiddlywiki/codemirror/files/codemirror.js | 0 .../codemirror/files/keymap/emacs.js | 0 .../codemirror/files/keymap/extra.js | 0 .../codemirror/files/keymap/sublime.js | 0 .../tiddlywiki/codemirror/files/keymap/vim.js | 0 .../files/mode/javascript/javascript.js | 0 .../codemirror/files/tiddlywiki.files | 0 plugins/tiddlywiki/codemirror/plugin.info | 0 plugins/tiddlywiki/codemirror/readme.tid | 0 plugins/tiddlywiki/codemirror/styles.tid | 0 plugins/tiddlywiki/codemirror/usage.tid | 0 .../internals/editpreviews/parse-tree.tid | 10 +- .../internals/editpreviews/shared.tid | 2 +- .../internals/editpreviews/widget-tree.tid | 10 +- .../internals/widgets/parse-tree.js | 75 ----- .../internals/widgets/widget-tree.js | 107 ------ plugins/tiddlywiki/markdown/dialect.tid | 0 .../markdown/docs_type_markdown.tid | 0 plugins/tiddlywiki/markdown/files/markdown.js | 0 .../markdown/files/tiddlywiki.files | 0 plugins/tiddlywiki/markdown/plugin.info | 0 plugins/tiddlywiki/markdown/readme.tid | 0 plugins/tiddlywiki/markdown/usage.tid | 0 plugins/tiddlywiki/markdown/wrapper.js | 0 .../translators/templates/snippet-tid.tid | 11 + .../tiddlywiki/translators/ui/editorTag.tid | 2 +- .../translators/ui/group/Snippets.tid | 16 + themes/tiddlywiki/vanilla/ThemeTweaks.tid | 23 +- themes/tiddlywiki/vanilla/base.tid | 117 ++++++- 234 files changed, 3899 insertions(+), 999 deletions(-) delete mode 100644 core/images/auto-height.tid delete mode 100644 core/images/bold.tid delete mode 100644 core/images/erase.tid delete mode 100644 core/images/excise.tid delete mode 100644 core/images/fixed-height.tid delete mode 100644 core/images/heading-1.tid delete mode 100644 core/images/heading-2.tid delete mode 100644 core/images/heading-3.tid delete mode 100644 core/images/heading-4.tid delete mode 100644 core/images/heading-5.tid delete mode 100644 core/images/heading-6.tid delete mode 100644 core/images/italic.tid delete mode 100644 core/images/line-width.tid delete mode 100644 core/images/list-bullet.tid delete mode 100644 core/images/list-number.tid delete mode 100644 core/images/mono-block.tid delete mode 100644 core/images/mono-line.tid delete mode 100644 core/images/new-image-button.tid delete mode 100644 core/images/opacity.tid delete mode 100644 core/images/paint.tid delete mode 100644 core/images/picture.tid delete mode 100644 core/images/preview-closed.tid delete mode 100644 core/images/preview-open.tid delete mode 100644 core/images/quote.tid delete mode 100644 core/images/redo.tid delete mode 100644 core/images/size.tid delete mode 100644 core/images/stamp.tid delete mode 100644 core/images/strikethrough.tid delete mode 100644 core/images/subscript.tid delete mode 100644 core/images/superscript.tid delete mode 100644 core/images/underline.tid delete mode 100644 core/images/undo.tid create mode 100644 core/language/en-GB/Snippets/ListByTag.tid create mode 100644 core/language/en-GB/Snippets/MacroDefinition.tid create mode 100644 core/language/en-GB/Snippets/Table 4x3.tid create mode 100644 core/language/en-GB/Snippets/TableOfContents.tid create mode 100644 core/modules/editor/engines/framed.js create mode 100644 core/modules/editor/engines/simple.js create mode 100644 core/modules/editor/factory.js create mode 100644 core/modules/editor/operations/bitmap/clear.js create mode 100644 core/modules/editor/operations/bitmap/resize.js create mode 100644 core/modules/editor/operations/text/excise.js create mode 100644 core/modules/editor/operations/text/prefix-lines.js create mode 100644 core/modules/editor/operations/text/redo.js create mode 100644 core/modules/editor/operations/text/replace-all.js create mode 100644 core/modules/editor/operations/text/replace-selection.js create mode 100644 core/modules/editor/operations/text/undo.js create mode 100644 core/modules/editor/operations/text/wrap-lines.js create mode 100644 core/modules/editor/operations/text/wrap-selection.js create mode 100644 core/modules/keyboard.js create mode 100644 core/modules/macros/displayshortcuts.js create mode 100644 core/modules/widgets/edit-shortcut.js create mode 100644 core/modules/widgets/wikify.js create mode 100644 core/ui/ControlPanel/KeyboardShortcuts.tid create mode 100644 core/ui/ControlPanel/Toolbars/EditorToolbar.tid create mode 100644 core/ui/EditTemplate/body-editor.tid create mode 100644 core/ui/EditTemplate/body-toolbar-button.tid create mode 100644 core/ui/EditorToolbar/bold.tid create mode 100644 core/ui/EditorToolbar/clear-dropdown.tid create mode 100644 core/ui/EditorToolbar/clear.tid create mode 100644 core/ui/EditorToolbar/editor-height-dropdown.tid create mode 100644 core/ui/EditorToolbar/editor-height.tid create mode 100644 core/ui/EditorToolbar/excise-dropdown.tid create mode 100644 core/ui/EditorToolbar/excise.tid create mode 100644 core/ui/EditorToolbar/heading-1.tid create mode 100644 core/ui/EditorToolbar/heading-2.tid create mode 100644 core/ui/EditorToolbar/heading-3.tid create mode 100644 core/ui/EditorToolbar/heading-4.tid create mode 100644 core/ui/EditorToolbar/heading-5.tid create mode 100644 core/ui/EditorToolbar/heading-6.tid create mode 100644 core/ui/EditorToolbar/italic.tid create mode 100644 core/ui/EditorToolbar/line-width-dropdown.tid create mode 100644 core/ui/EditorToolbar/line-width.tid create mode 100644 core/ui/EditorToolbar/list-bullet.tid create mode 100644 core/ui/EditorToolbar/list-number.tid create mode 100644 core/ui/EditorToolbar/mono-block.tid create mode 100644 core/ui/EditorToolbar/mono-line.tid create mode 100644 core/ui/EditorToolbar/more-dropdown.tid create mode 100644 core/ui/EditorToolbar/more.tid create mode 100644 core/ui/EditorToolbar/opacity-dropdown.tid create mode 100644 core/ui/EditorToolbar/opacity.tid create mode 100644 core/ui/EditorToolbar/paint-dropdown.tid create mode 100644 core/ui/EditorToolbar/paint.tid create mode 100644 core/ui/EditorToolbar/picture-dropdown.tid create mode 100644 core/ui/EditorToolbar/picture.tid create mode 100644 core/ui/EditorToolbar/preview-type-dropdown.tid create mode 100644 core/ui/EditorToolbar/preview-type.tid create mode 100644 core/ui/EditorToolbar/preview.tid create mode 100644 core/ui/EditorToolbar/quote.tid create mode 100644 core/ui/EditorToolbar/redo.tid create mode 100644 core/ui/EditorToolbar/size-dropdown.tid create mode 100644 core/ui/EditorToolbar/size.tid create mode 100644 core/ui/EditorToolbar/stamp-dropdown.tid create mode 100644 core/ui/EditorToolbar/stamp.tid create mode 100644 core/ui/EditorToolbar/strikethrough.tid create mode 100644 core/ui/EditorToolbar/subscript.tid create mode 100644 core/ui/EditorToolbar/superscript.tid create mode 100644 core/ui/EditorToolbar/underline.tid create mode 100644 core/ui/EditorToolbar/undo.tid create mode 100644 core/ui/PageControls/new-image.tid create mode 100644 core/wiki/config/BitmapEditorImageSizes.tid create mode 100644 core/wiki/config/BitmapEditorLineWidths.tid create mode 100644 core/wiki/config/BitmapEditorOpacities.tid create mode 100644 core/wiki/config/BitmapEditorOpacity.tid create mode 100644 core/wiki/config/EditorToolbarButtons.multids create mode 100644 core/wiki/config/ShortcutInfo.multids create mode 100644 core/wiki/config/TextEditorEditorHeightHeight.tid create mode 100644 core/wiki/config/TextEditorEditorHeightMode.tid delete mode 100644 core/wiki/config/shortcuts/cancel-edit-tiddler.tid delete mode 100644 core/wiki/config/shortcuts/save-tiddler.tid create mode 100644 core/wiki/config/shortcuts/shortcuts-linux.multids create mode 100644 core/wiki/config/shortcuts/shortcuts-mac.multids create mode 100644 core/wiki/config/shortcuts/shortcuts-not-linux.multids create mode 100644 core/wiki/config/shortcuts/shortcuts-not-mac.multids create mode 100644 core/wiki/config/shortcuts/shortcuts-not-windows.multids create mode 100644 core/wiki/config/shortcuts/shortcuts-windows.multids create mode 100644 core/wiki/config/shortcuts/shortcuts.multids create mode 100644 core/wiki/macros/colour-picker.tid create mode 100644 core/wiki/macros/image-picker.tid create mode 100644 core/wiki/macros/translink.tid create mode 100644 core/wiki/tags/EditorToolbar.tid delete mode 100644 editions/tw5.com/tiddlers/hiddensettings/Hidden_Setting__Keyboard_Shortcuts.tid create mode 100644 editions/tw5.com/tiddlers/macros/colour-picker_Macro.tid create mode 100644 editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Example_1).tid create mode 100644 editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Examples).tid create mode 100644 editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Example_1).tid create mode 100644 editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Examples).tid create mode 100644 editions/tw5.com/tiddlers/macros/image-picker_Macro.tid rename editions/{prerelease/tiddlers => tw5.com/tiddlers/releasenotes}/Release 5.1.12.tid (50%) create mode 100644 editions/tw5.com/tiddlers/widgets/EntityWidget.tid create mode 100644 editions/tw5.com/tiddlers/widgets/WikifyWidget.tid create mode 100644 languages/fr-FR/Snippets/ListByTag.tid create mode 100644 languages/fr-FR/Snippets/Table 4x3.tid create mode 100644 languages/fr-FR/Snippets/TableOfContents.tid create mode 100644 languages/zh-Hans/Snippets/ListByTag.tid create mode 100644 languages/zh-Hans/Snippets/MacroDefinition.tid create mode 100644 languages/zh-Hans/Snippets/Table 4x3.tid create mode 100644 languages/zh-Hans/Snippets/TableOfContents.tid create mode 100644 languages/zh-Hant/Snippets/ListByTag.tid create mode 100644 languages/zh-Hant/Snippets/MacroDefinition.tid create mode 100644 languages/zh-Hant/Snippets/Table 4x3.tid create mode 100644 languages/zh-Hant/Snippets/TableOfContents.tid mode change 100644 => 100755 plugins/tiddlywiki/codemirror/EditorTypeMappings.multids mode change 100644 => 100755 plugins/tiddlywiki/codemirror/edit-codemirror.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/addon/dialog/dialog.css mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/addon/dialog/dialog.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/addon/edit/matchbrackets.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/addon/search/searchcursor.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/codemirror.css mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/codemirror.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/keymap/emacs.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/keymap/extra.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/keymap/sublime.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/keymap/vim.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/mode/javascript/javascript.js mode change 100644 => 100755 plugins/tiddlywiki/codemirror/files/tiddlywiki.files mode change 100644 => 100755 plugins/tiddlywiki/codemirror/plugin.info mode change 100644 => 100755 plugins/tiddlywiki/codemirror/readme.tid mode change 100644 => 100755 plugins/tiddlywiki/codemirror/styles.tid mode change 100644 => 100755 plugins/tiddlywiki/codemirror/usage.tid delete mode 100644 plugins/tiddlywiki/internals/widgets/parse-tree.js delete mode 100644 plugins/tiddlywiki/internals/widgets/widget-tree.js mode change 100644 => 100755 plugins/tiddlywiki/markdown/dialect.tid mode change 100644 => 100755 plugins/tiddlywiki/markdown/docs_type_markdown.tid mode change 100644 => 100755 plugins/tiddlywiki/markdown/files/markdown.js mode change 100644 => 100755 plugins/tiddlywiki/markdown/files/tiddlywiki.files mode change 100644 => 100755 plugins/tiddlywiki/markdown/plugin.info mode change 100644 => 100755 plugins/tiddlywiki/markdown/readme.tid mode change 100644 => 100755 plugins/tiddlywiki/markdown/usage.tid mode change 100644 => 100755 plugins/tiddlywiki/markdown/wrapper.js create mode 100644 plugins/tiddlywiki/translators/templates/snippet-tid.tid create mode 100644 plugins/tiddlywiki/translators/ui/group/Snippets.tid diff --git a/core/images/auto-height.tid b/core/images/auto-height.tid deleted file mode 100644 index e65b9c5b6..000000000 --- a/core/images/auto-height.tid +++ /dev/null @@ -1,6 +0,0 @@ -title: $:/core/images/auto-height -tags: $:/tags/Image - - - - \ No newline at end of file diff --git a/core/images/bold.tid b/core/images/bold.tid deleted file mode 100644 index 0e5d9d8d6..000000000 --- a/core/images/bold.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/bold -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/erase.tid b/core/images/erase.tid deleted file mode 100644 index ba18f5bd0..000000000 --- a/core/images/erase.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/erase -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/excise.tid b/core/images/excise.tid deleted file mode 100644 index 2360cb5a7..000000000 --- a/core/images/excise.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/excise -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/fixed-height.tid b/core/images/fixed-height.tid deleted file mode 100644 index 3b53256ab..000000000 --- a/core/images/fixed-height.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/fixed-height -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/heading-1.tid b/core/images/heading-1.tid deleted file mode 100644 index 94d57dee9..000000000 --- a/core/images/heading-1.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/heading-1 -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/heading-2.tid b/core/images/heading-2.tid deleted file mode 100644 index 65b2e3750..000000000 --- a/core/images/heading-2.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/heading-2 -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/heading-3.tid b/core/images/heading-3.tid deleted file mode 100644 index 6899440a7..000000000 --- a/core/images/heading-3.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/heading-3 -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/heading-4.tid b/core/images/heading-4.tid deleted file mode 100644 index c30a44692..000000000 --- a/core/images/heading-4.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/heading-4 -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/heading-5.tid b/core/images/heading-5.tid deleted file mode 100644 index 8e0a7fdc8..000000000 --- a/core/images/heading-5.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/heading-5 -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/heading-6.tid b/core/images/heading-6.tid deleted file mode 100644 index 93f7bcfd7..000000000 --- a/core/images/heading-6.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/heading-6 -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/italic.tid b/core/images/italic.tid deleted file mode 100644 index f7c46b55c..000000000 --- a/core/images/italic.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/italic -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/line-width.tid b/core/images/line-width.tid deleted file mode 100644 index 1e8854c4e..000000000 --- a/core/images/line-width.tid +++ /dev/null @@ -1,9 +0,0 @@ -title: $:/core/images/line-width -tags: $:/tags/Image - - - - - - - \ No newline at end of file diff --git a/core/images/list-bullet.tid b/core/images/list-bullet.tid deleted file mode 100644 index 7951ad229..000000000 --- a/core/images/list-bullet.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/list-bullet -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/list-number.tid b/core/images/list-number.tid deleted file mode 100644 index 768f16d25..000000000 --- a/core/images/list-number.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/list-number -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/mono-block.tid b/core/images/mono-block.tid deleted file mode 100644 index 1675e3854..000000000 --- a/core/images/mono-block.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/mono-block -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/mono-line.tid b/core/images/mono-line.tid deleted file mode 100644 index 81d0faf3f..000000000 --- a/core/images/mono-line.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/mono-line -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/new-image-button.tid b/core/images/new-image-button.tid deleted file mode 100644 index 5109bf98d..000000000 --- a/core/images/new-image-button.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/new-image-button -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/opacity.tid b/core/images/opacity.tid deleted file mode 100644 index e9bb732e1..000000000 --- a/core/images/opacity.tid +++ /dev/null @@ -1,10 +0,0 @@ -title: $:/core/images/opacity -tags: $:/tags/Image - - - - - - - - \ No newline at end of file diff --git a/core/images/paint.tid b/core/images/paint.tid deleted file mode 100644 index c6dcab834..000000000 --- a/core/images/paint.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/paint -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/picture.tid b/core/images/picture.tid deleted file mode 100644 index 71d2bf1a6..000000000 --- a/core/images/picture.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/picture -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/preview-closed.tid b/core/images/preview-closed.tid deleted file mode 100644 index 506e9f3ef..000000000 --- a/core/images/preview-closed.tid +++ /dev/null @@ -1,15 +0,0 @@ -title: $:/core/images/preview-closed -tags: $:/tags/Image - - - - - - - - - - - - - \ No newline at end of file diff --git a/core/images/preview-open.tid b/core/images/preview-open.tid deleted file mode 100644 index 17f2319e1..000000000 --- a/core/images/preview-open.tid +++ /dev/null @@ -1,9 +0,0 @@ -title: $:/core/images/preview-open -tags: $:/tags/Image - - - - - - - \ No newline at end of file diff --git a/core/images/quote.tid b/core/images/quote.tid deleted file mode 100644 index 882b1debc..000000000 --- a/core/images/quote.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/quote -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/redo.tid b/core/images/redo.tid deleted file mode 100644 index 9bf751ea9..000000000 --- a/core/images/redo.tid +++ /dev/null @@ -1,11 +0,0 @@ -title: $:/core/images/redo -tags: $:/tags/Image - - - - - - - - - \ No newline at end of file diff --git a/core/images/size.tid b/core/images/size.tid deleted file mode 100644 index 4822dbb50..000000000 --- a/core/images/size.tid +++ /dev/null @@ -1,6 +0,0 @@ -title: $:/core/images/size -tags: $:/tags/Image - - - - \ No newline at end of file diff --git a/core/images/stamp.tid b/core/images/stamp.tid deleted file mode 100644 index ab8949c1d..000000000 --- a/core/images/stamp.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/stamp -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/strikethrough.tid b/core/images/strikethrough.tid deleted file mode 100644 index 80898c870..000000000 --- a/core/images/strikethrough.tid +++ /dev/null @@ -1,9 +0,0 @@ -title: $:/core/images/strikethrough -tags: $:/tags/Image - - - - - - - \ No newline at end of file diff --git a/core/images/subscript.tid b/core/images/subscript.tid deleted file mode 100644 index a56aa2f1d..000000000 --- a/core/images/subscript.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/subscript -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/superscript.tid b/core/images/superscript.tid deleted file mode 100644 index ca48636e0..000000000 --- a/core/images/superscript.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/superscript -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/underline.tid b/core/images/underline.tid deleted file mode 100644 index 22465748b..000000000 --- a/core/images/underline.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/underline -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/images/undo.tid b/core/images/undo.tid deleted file mode 100644 index aff7a99ff..000000000 --- a/core/images/undo.tid +++ /dev/null @@ -1,8 +0,0 @@ -title: $:/core/images/undo -tags: $:/tags/Image - - - - - - \ No newline at end of file diff --git a/core/language/en-GB/Buttons.multids b/core/language/en-GB/Buttons.multids index 1c1c23c50..fe6c47695 100644 --- a/core/language/en-GB/Buttons.multids +++ b/core/language/en-GB/Buttons.multids @@ -62,6 +62,10 @@ NewJournal/Caption: new journal NewJournal/Hint: Create a new journal tiddler NewJournalHere/Caption: new journal here NewJournalHere/Hint: Create a new journal tiddler tagged with this one +NewImage/Caption: new image +NewImage/Hint: Create a new image tiddler +NewMarkdown/Caption: new Markdown tiddler +NewMarkdown/Hint: Create a new Markdown tiddler NewTiddler/Caption: new tiddler NewTiddler/Hint: Create a new tiddler OpenWindow/Caption: open in new window @@ -88,3 +92,81 @@ TagManager/Caption: tag manager TagManager/Hint: Open tag manager Theme/Caption: theme Theme/Hint: Choose the display theme +Bold/Caption: bold +Bold/Hint: Apply bold formatting to selection +Clear/Caption: clear +Clear/Hint: Clear image to solid colour +EditorHeight/Caption: editor height +EditorHeight/Caption/Auto: Automatically adjust height to fit content +EditorHeight/Caption/Fixed: Fixed height: +EditorHeight/Hint: Choose the height of the text editor +Excise/Caption: excise +Excise/Caption/Excise: Perform excision +Excise/Caption/MacroName: Macro name: +Excise/Caption/NewTitle: Title of new tiddler: +Excise/Caption/Replace: Replace excised text with: +Excise/Caption/Replace/Macro: macro +Excise/Caption/Replace/Link: link +Excise/Caption/Replace/Transclusion: transclusion +Excise/Caption/Tag: Tag new tiddler with the title of this tiddler +Excise/Caption/TiddlerExists: Warning: tiddler already exists +Excise/Hint: Excise the selected text into a new tiddler +Heading1/Caption: heading 1 +Heading1/Hint: Apply heading level 1 formatting to lines containing selection +Heading2/Caption: heading 2 +Heading2/Hint: Apply heading level 2 formatting to lines containing selection +Heading3/Caption: heading 3 +Heading3/Hint: Apply heading level 3 formatting to lines containing selection +Heading4/Caption: heading 4 +Heading4/Hint: Apply heading level 4 formatting to lines containing selection +Heading5/Caption: heading 5 +Heading5/Hint: Apply heading level 5 formatting to lines containing selection +Heading6/Caption: heading 6 +Heading6/Hint: Apply heading level 6 formatting to lines containing selection +Italic/Caption: italic +Italic/Hint: Apply italic formatting to selection +LineWidth/Caption: line width +LineWidth/Hint: Set line width for painting +ListBullet/Caption: bulleted list +ListBullet/Hint: Apply bulleted list formatting to lines containing selection +ListNumber/Caption: numbered list +ListNumber/Hint: Apply numbered list formatting to lines containing selection +MonoBlock/Caption: monospaced block +MonoBlock/Hint: Apply monospaced block formatting to lines containing selection +MonoLine/Caption: monospaced +MonoLine/Hint: Apply monospaced character formatting to selection +Opacity/Caption: opacity +Opacity/Hint: Set painting opacity +Paint/Caption: paint colour +Paint/Hint: Set painting colour +Picture/Caption: picture +Picture/Hint: Insert picture +Preview/Caption: preview +Preview/Hint: Show preview pane +PreviewType/Caption: preview type +PreviewType/Hint: Choose preview type +Quote/Caption: quote +Quote/Hint: Apply quoted text formatting to lines containing selection +Redo/Caption: redo +Redo/Hint: Redo the last action to be undone +Size/Caption: image size +Size/Caption/Height: Height: +Size/Caption/Resize: Resize image +Size/Caption/Width: Width: +Size/Hint: Set image size +Stamp/Caption: stamp +Stamp/Caption/New: Add your own +Stamp/Hint: Insert a preconfigured snippet of text +Stamp/New/Title: Name as shown in menu +Stamp/New/Text: Text of snippet. (Remember to add a descriptive title in the caption field). +Strikethrough/Caption: strikethrough +Strikethrough/Hint: Apply strikethrough formatting to selection +Subscript/Caption: subscript +Subscript/Hint: Apply subscript formatting to selection +Superscript/Caption: superscript +Superscript/Hint: Apply superscript formatting to selection +Underline/Caption: underline +Underline/Hint: Apply underline formatting to selection +Undo/Caption: undo +Undo/Hint: Undo the last action + diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 3a9b0397d..516bdaea7 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -27,6 +27,19 @@ EditorTypes/Hint: These tiddlers determine which editor is used to edit specific EditorTypes/Type/Caption: Type Info/Caption: Info Info/Hint: Information about this TiddlyWiki +KeyboardShortcuts/Add/Prompt: Type shortcut here +KeyboardShortcuts/Add/Caption: add shortcut +KeyboardShortcuts/Caption: Keyboard Shortcuts +KeyboardShortcuts/Hint: Manage keyboard shortcut assignments +KeyboardShortcuts/NoShortcuts/Caption: No keyboard shortcuts assigned +KeyboardShortcuts/Remove/Hint: remove keyboard shortcut +KeyboardShortcuts/Platform/All: All platforms +KeyboardShortcuts/Platform/Mac: Macintosh platform only +KeyboardShortcuts/Platform/NonMac: Non-Macintosh platforms only +KeyboardShortcuts/Platform/Linux: Linux platform only +KeyboardShortcuts/Platform/NonLinux: Non-Linux platforms only +KeyboardShortcuts/Platform/Windows: Windows platform only +KeyboardShortcuts/Platform/NonWindows: Non-Windows platforms only LoadedModules/Caption: Loaded Modules LoadedModules/Hint: These are the currently loaded tiddler modules linked to their source tiddlers. Any italicised modules lack a source tiddler, typically because they were setup during the boot process. Palette/Caption: Palette @@ -136,6 +149,8 @@ Toolbars/EditToolbar/Hint: Choose which buttons are displayed for tiddlers in ed Toolbars/Hint: Select which toolbar buttons are displayed Toolbars/PageControls/Caption: Page Toolbar Toolbars/PageControls/Hint: Choose which buttons are displayed on the main page toolbar +Toolbars/EditorToolbar/Caption: Editor Toolbar +Toolbars/EditorToolbar/Hint: Choose which buttons are displayed in the editor toolbar. Note that some buttons will only appear when editing tiddlers of a certain type Toolbars/ViewToolbar/Caption: View Toolbar Toolbars/ViewToolbar/Hint: Choose which buttons are displayed for tiddlers in view mode Tools/Download/Full/Caption: Download full wiki diff --git a/core/language/en-GB/EditTemplate.multids b/core/language/en-GB/EditTemplate.multids index bf19b3e45..8d8801af9 100644 --- a/core/language/en-GB/EditTemplate.multids +++ b/core/language/en-GB/EditTemplate.multids @@ -1,11 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: This is an external tiddler stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself -Body/Hint: Use [[wiki text|http://tiddlywiki.com/static/WikiText.html]] to add formatting, images, and dynamic features Body/Placeholder: Type the text for this tiddler -Body/Preview/Button/Hide: hide preview -Body/Preview/Button/Show: show preview -Body/Preview/Type: preview type: Body/Preview/Type/Output: output Field/Remove/Caption: remove field Field/Remove/Hint: Remove field diff --git a/core/language/en-GB/GettingStarted.tid b/core/language/en-GB/GettingStarted.tid index 2be983442..5911f04d7 100644 --- a/core/language/en-GB/GettingStarted.tid +++ b/core/language/en-GB/GettingStarted.tid @@ -11,7 +11,7 @@ Before you start storing important information in ~TiddlyWiki it is important to |<$link to="$:/SiteTitle"><> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> | |<$link to="$:/SiteSubtitle"><> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> | -|<$link to="$:/DefaultTiddlers"><> |<>
<$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/>
//<>// | +|<$link to="$:/DefaultTiddlers"><> |<>
<$edit tag="textarea" tiddler="$:/DefaultTiddlers"/>
//<>// | See the [[control panel|$:/ControlPanel]] for more options. diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index d953eb01f..dea3a8830 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -5,6 +5,7 @@ BinaryWarning/Prompt: This tiddler contains binary data ClassicWarning/Hint: This tiddler is written in TiddlyWiki Classic wiki text format, which is not fully compatible with TiddlyWiki version 5. See http://tiddlywiki.com/static/Upgrading.html for more details. ClassicWarning/Upgrade/Caption: upgrade CloseAll/Button: close all +ColourPicker/Recent: Recent: ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text=<>/>"? ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"? ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"? diff --git a/core/language/en-GB/Snippets/ListByTag.tid b/core/language/en-GB/Snippets/ListByTag.tid new file mode 100644 index 000000000..7f1001924 --- /dev/null +++ b/core/language/en-GB/Snippets/ListByTag.tid @@ -0,0 +1,6 @@ +title: $:/language/Snippets/ListByTag +tags: $:/tags/TextEditor/Snippet +caption: List of tiddlers by tag +mode: wikified + +<<list-links "[tag[task]sort[title]]">> diff --git a/core/language/en-GB/Snippets/MacroDefinition.tid b/core/language/en-GB/Snippets/MacroDefinition.tid new file mode 100644 index 000000000..28f10bf5e --- /dev/null +++ b/core/language/en-GB/Snippets/MacroDefinition.tid @@ -0,0 +1,8 @@ +title: $:/language/Snippets/MacroDefinition +tags: $:/tags/TextEditor/Snippet +caption: Macro definition +mode: wikified + +\define macroName(param1:"default value",param2) +Text of the macro +\end diff --git a/core/language/en-GB/Snippets/Table 4x3.tid b/core/language/en-GB/Snippets/Table 4x3.tid new file mode 100644 index 000000000..fb543a4ee --- /dev/null +++ b/core/language/en-GB/Snippets/Table 4x3.tid @@ -0,0 +1,9 @@ +title: $:/language/Snippets/Table4x3 +tags: $:/tags/TextEditor/Snippet +caption: Table with 4 columns by 3 rows +mode: wikified + +|! |!Alpha |!Beta |!Gamma |!Delta | +|!One | | | | | +|!Two | | | | | +|!Three | | | | | diff --git a/core/language/en-GB/Snippets/TableOfContents.tid b/core/language/en-GB/Snippets/TableOfContents.tid new file mode 100644 index 000000000..3b246da29 --- /dev/null +++ b/core/language/en-GB/Snippets/TableOfContents.tid @@ -0,0 +1,10 @@ +title: $:/language/Snippets/TableOfContents +tags: $:/tags/TextEditor/Snippet +caption: Table of Contents +mode: wikified + +<div class="tc-table-of-contents"> + +<<toc-selective-expandable 'TableOfContents'>> + +</div> \ No newline at end of file diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js new file mode 100644 index 000000000..a855d4356 --- /dev/null +++ b/core/modules/editor/engines/framed.js @@ -0,0 +1,211 @@ +/*\ +title: $:/core/modules/editor/engines/framed.js +type: application/javascript +module-type: library + +Text editor engine based on a simple input or textarea within an iframe. This is done so that the selection is preserved even when clicking away from the textarea + +\*/ +(function(){ + +var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height" + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +function FramedEngine(options) { + // Save our options + options = options || {}; + this.widget = options.widget; + this.value = options.value; + this.parentNode = options.parentNode; + this.nextSibling = options.nextSibling; + // Create our hidden dummy text area for reading styles + this.dummyTextArea = this.widget.document.createElement("textarea"); + if(this.widget.editClass) { + this.dummyTextArea.className = this.widget.editClass; + } + this.dummyTextArea.setAttribute("hidden","true"); + this.parentNode.insertBefore(this.dummyTextArea,this.nextSibling); + this.widget.domNodes.push(this.dummyTextArea); + // Create the iframe + this.iframeNode = this.widget.document.createElement("iframe"); + this.parentNode.insertBefore(this.iframeNode,this.nextSibling); + this.iframeDoc = this.iframeNode.contentWindow.document; + // (Firefox requires us to put some empty content in the iframe) + this.iframeDoc.open(); + this.iframeDoc.write(""); + this.iframeDoc.close(); + // Style the iframe + this.iframeNode.className = this.dummyTextArea.className; + this.iframeNode.style.border = "none"; + this.iframeNode.style.padding = "0"; + this.iframeNode.style.resize = "none"; + this.iframeDoc.body.style.margin = "0"; + this.iframeDoc.body.style.padding = "0"; + this.widget.domNodes.push(this.iframeNode); + // Construct the textarea or input node + var tag = this.widget.editTag; + if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) { + tag = "input"; + } + this.domNode = this.iframeDoc.createElement(tag); + if(this.widget.editType) { + this.domNode.setAttribute("type",this.widget.editType); + } + if(this.widget.editPlaceholder) { + this.domNode.setAttribute("placeholder",this.widget.editPlaceholder); + } + if(this.widget.editSize) { + this.domNode.setAttribute("size",this.widget.editSize); + } + if(this.widget.editRows) { + this.domNode.setAttribute("rows",this.widget.editRows); + } + // Copy the styles from the dummy textarea + $tw.utils.copyStyles(this.dummyTextArea,this.domNode); + this.domNode.style.display = "block"; + this.domNode.style.width = "100%"; + this.domNode.style.margin = "0"; + // Set the text + if(this.widget.editTag === "textarea") { + this.domNode.appendChild(this.iframeDoc.createTextNode(this.value)); + } else { + this.domNode.value = this.value; + } + // Add event listeners + $tw.utils.addEventListeners(this.domNode,[ + {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"}, + {name: "keydown", handlerObject: this.widget, handlerMethod: "handleKeydownEvent"} + ]); + // Insert the element into the DOM + this.iframeDoc.body.appendChild(this.domNode); +} + +/* +Set the text of the engine if it doesn't currently have focus +*/ +FramedEngine.prototype.setText = function(text,type) { + if(!this.domNode.isTiddlyWikiFakeDom) { + if(this.domNode.ownerDocument.activeElement !== this.domNode) { + this.domNode.value = text; + } + // Fix the height if needed + this.fixHeight(); + } +}; + +/* +Get the text of the engine +*/ +FramedEngine.prototype.getText = function() { + return this.domNode.value; +}; + +/* +Fix the height of textarea to fit content +*/ +FramedEngine.prototype.fixHeight = function() { + if(this.widget.editTag === "textarea") { + if(this.widget.editAutoHeight) { + if(this.domNode && !this.domNode.isTiddlyWikiFakeDom) { + var newHeight = $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight); + this.iframeNode.style.height = (newHeight + 14) + "px"; // +14 for the border on the textarea + } + } else { + var fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,"400px"),10); + fixedHeight = Math.max(fixedHeight,20); + this.domNode.style.height = fixedHeight + "px"; + this.iframeNode.style.height = (fixedHeight + 14) + "px"; + } + } +}; + +/* +Focus the engine node +*/ +FramedEngine.prototype.focus = function() { + if(this.domNode.focus && this.domNode.select) { + this.domNode.focus(); + this.domNode.select(); + } +} + +/* +Handle a dom "input" event which occurs when the text has changed +*/ +FramedEngine.prototype.handleInputEvent = function(event) { + this.widget.saveChanges(this.getText()); + this.fixHeight(); + return true; +}; + +/* +Create a blank structure representing a text operation +*/ +FramedEngine.prototype.createTextOperation = function() { + var operation = { + text: this.domNode.value, + selStart: this.domNode.selectionStart, + selEnd: this.domNode.selectionEnd, + cutStart: null, + cutEnd: null, + replacement: null, + newSelStart: null, + newSelEnd: null + }; + operation.selection = operation.text.substring(operation.selStart,operation.selEnd); + return operation; +}; + +/* +Execute a text operation +*/ +FramedEngine.prototype.executeTextOperation = function(operation) { + // Perform the required changes to the text area and the underlying tiddler + var newText = operation.text; + if(operation.replacement !== null) { + // Work around the problem that textInput can't be used directly to delete text without also replacing it with a non-zero length string + if(operation.replacement === "") { + operation.replacement = operation.text.substring(0,operation.cutStart) + operation.text.substring(operation.cutEnd); + operation.cutStart = 0; + operation.cutEnd = operation.text.length; + } + newText = operation.text.substring(0,operation.cutStart) + operation.replacement + operation.text.substring(operation.cutEnd); + // Attempt to use a TextEvent to modify the value of the control + var textEvent = this.domNode.ownerDocument.createEvent("TextEvent"); + if(textEvent.initTextEvent) { + textEvent.initTextEvent("textInput", true, true, null, operation.replacement, 9, "en-US"); + this.domNode.focus(); + this.domNode.setSelectionRange(operation.cutStart,operation.cutEnd); + this.domNode.dispatchEvent(textEvent); + } else { + this.domNode.value = newText; + } + this.domNode.focus(); + this.domNode.setSelectionRange(operation.newSelStart,operation.newSelEnd); + } + this.domNode.focus(); + return newText; +}; + +/* +Execute a command +*/ +FramedEngine.prototype.execCommand = function(command) { + this.iframeNode.focus(); + this.domNode.focus(); + switch(command) { + case "undo": + this.iframeDoc.execCommand("undo", false, null); + break; + case "redo": + this.iframeDoc.execCommand("redo", false, null); + break; + } +}; + +exports.FramedEngine = FramedEngine; + +})(); diff --git a/core/modules/editor/engines/simple.js b/core/modules/editor/engines/simple.js new file mode 100644 index 000000000..84d407123 --- /dev/null +++ b/core/modules/editor/engines/simple.js @@ -0,0 +1,153 @@ +/*\ +title: $:/core/modules/editor/engines/simple.js +type: application/javascript +module-type: library + +Text editor engine based on a simple input or textarea tag + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var HEIGHT_VALUE_TITLE = "$:/config/TextEditor/EditorHeight/Height"; + +function SimpleEngine(options) { + // Save our options + options = options || {}; + this.widget = options.widget; + this.value = options.value; + this.parentNode = options.parentNode; + this.nextSibling = options.nextSibling; + // Construct the textarea or input node + var tag = this.widget.editTag; + if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) { + tag = "input"; + } + this.domNode = this.widget.document.createElement(tag); + if(this.widget.editType) { + this.domNode.setAttribute("type",this.widget.editType); + } + if(this.widget.editPlaceholder) { + this.domNode.setAttribute("placeholder",this.widget.editPlaceholder); + } + if(this.widget.editSize) { + this.domNode.setAttribute("size",this.widget.editSize); + } + if(this.widget.editRows) { + this.domNode.setAttribute("rows",this.widget.editRows); + } + if(this.widget.editClass) { + this.domNode.className = this.widget.editClass; + } + // Set the text + if(this.widget.editTag === "textarea") { + this.domNode.appendChild(this.widget.document.createTextNode(this.value)); + } else { + this.domNode.value = this.value; + } + // Add an input event handler + $tw.utils.addEventListeners(this.domNode,[ + {name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"}, + {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"} + ]); + // Insert the element into the DOM + this.parentNode.insertBefore(this.domNode,this.nextSibling); + this.widget.domNodes.push(this.domNode); +} + +/* +Set the text of the engine if it doesn't currently have focus +*/ +SimpleEngine.prototype.setText = function(text,type) { + if(!this.domNode.isTiddlyWikiFakeDom) { + if(this.domNode.ownerDocument.activeElement !== this.domNode) { + this.domNode.value = text; + } + // Fix the height if needed + this.fixHeight(); + } +}; + +/* +Get the text of the engine +*/ +SimpleEngine.prototype.getText = function() { + return this.domNode.value; +}; + +/* +Fix the height of textarea to fit content +*/ +SimpleEngine.prototype.fixHeight = function() { + if(this.widget.editTag === "textarea") { + if(this.widget.editAutoHeight) { + if(this.domNode && !this.domNode.isTiddlyWikiFakeDom) { + $tw.utils.resizeTextAreaToFit(this.domNode,this.widget.editMinHeight); + } + } else { + var fixedHeight = parseInt(this.widget.wiki.getTiddlerText(HEIGHT_VALUE_TITLE,"400px"),10); + fixedHeight = Math.max(fixedHeight,20); + this.domNode.style.height = fixedHeight + "px"; + } + } +}; + +/* +Focus the engine node +*/ +SimpleEngine.prototype.focus = function() { + if(this.domNode.focus && this.domNode.select) { + this.domNode.focus(); + this.domNode.select(); + } +} + +/* +Handle a dom "input" event which occurs when the text has changed +*/ +SimpleEngine.prototype.handleInputEvent = function(event) { + this.widget.saveChanges(this.getText()); + this.fixHeight(); + return true; +}; + +/* +Handle a dom "focus" event +*/ +SimpleEngine.prototype.handleFocusEvent = function(event) { + if(this.widget.editFocusPopup) { + $tw.popup.triggerPopup({ + domNode: this.domNode, + title: this.widget.editFocusPopup, + wiki: this.widget.wiki, + force: true + }); + } + return true; +}; + +/* +Create a blank structure representing a text operation +*/ +SimpleEngine.prototype.createTextOperation = function() { + return null; +}; + +/* +Execute a command +*/ +SimpleEngine.prototype.execCommand = function() { +}; + +/* +Execute a text operation +*/ +SimpleEngine.prototype.executeTextOperation = function(operation) { +}; + +exports.SimpleEngine = SimpleEngine; + +})(); diff --git a/core/modules/editor/factory.js b/core/modules/editor/factory.js new file mode 100644 index 000000000..66bdafd26 --- /dev/null +++ b/core/modules/editor/factory.js @@ -0,0 +1,309 @@ +/*\ +title: $:/core/modules/editor/factory.js +type: application/javascript +module-type: library + +Factory for constructing text editor widgets with specified engines for the toolbar and non-toolbar cases + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pixels + +// Configuration tiddlers +var HEIGHT_MODE_TITLE = "$:/config/TextEditor/EditorHeight/Mode"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { + + var EditTextWidget = function(parseTreeNode,options) { + // Initialise the editor operations if they've not been done already + if(!this.editorOperations) { + EditTextWidget.prototype.editorOperations = {}; + $tw.modules.applyMethods("texteditoroperation",this.editorOperations); + } + this.initialise(parseTreeNode,options); + }; + + /* + Inherit from the base widget class + */ + EditTextWidget.prototype = new Widget(); + + /* + Render this widget into the DOM + */ + EditTextWidget.prototype.render = function(parent,nextSibling) { + var self = this; + // Save the parent dom node + this.parentDomNode = parent; + // Compute our attributes + this.computeAttributes(); + // Execute our logic + this.execute(); + // Create the wrapper for the toolbar and render its content + if(this.editShowToolbar) { + this.toolbarNode = this.document.createElement("div"); + this.toolbarNode.className = "tc-editor-toolbar"; + parent.insertBefore(this.toolbarNode,nextSibling); + this.renderChildren(this.toolbarNode,null); + this.domNodes.push(this.toolbarNode); + } + // Create our element + var editInfo = this.getEditInfo(), + Engine = this.editShowToolbar ? toolbarEngine : nonToolbarEngine; + this.engine = new Engine({ + widget: this, + value: editInfo.value, + type: editInfo.type, + parentNode: parent, + nextSibling: nextSibling + }); + // Call the postRender hook + if(this.postRender) { + this.postRender(); + } + // Fix height + this.engine.fixHeight(); + // Focus if required + if(this.editFocus === "true") { + this.engine.focus(); + } + // Add widget message listeners + this.addEventListeners([ + {type: "tm-edit-text-operation", handler: "handleEditTextOperationMessage"} + ]); + }; + + /* + Get the tiddler being edited and current value + */ + EditTextWidget.prototype.getEditInfo = function() { + // Get the edit value + var self = this, + value, + type = "text/plain", + update; + if(this.editIndex) { + value = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault); + update = function(value) { + var data = self.wiki.getTiddlerData(self.editTitle,{}); + if(data[self.editIndex] !== value) { + data[self.editIndex] = value; + self.wiki.setTiddlerData(self.editTitle,data); + } + }; + } else { + // Get the current tiddler and the field name + var tiddler = this.wiki.getTiddler(this.editTitle); + if(tiddler) { + // If we've got a tiddler, the value to display is the field string value + value = tiddler.getFieldString(this.editField); + if(this.editField === "text") { + type = tiddler.fields.type || "text/vnd.tiddlywiki"; + } + } else { + // Otherwise, we need to construct a default value for the editor + switch(this.editField) { + case "text": + value = "Type the text for the tiddler '" + this.editTitle + "'"; + type = "text/vnd.tiddlywiki"; + break; + case "title": + value = this.editTitle; + break; + default: + value = ""; + break; + } + if(this.editDefault !== undefined) { + value = this.editDefault; + } + } + update = function(value) { + var tiddler = self.wiki.getTiddler(self.editTitle), + updateFields = { + title: self.editTitle + }; + updateFields[self.editField] = value; + self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields())); + }; + } + if(this.editType) { + type = this.editType; + } + return {value: value || "", type: type, update: update}; + }; + + /* + Handle an edit text operation message from the toolbar + */ + EditTextWidget.prototype.handleEditTextOperationMessage = function(event) { + // Prepare information about the operation + var operation = this.engine.createTextOperation(); + // Invoke the handler for the selected operation + var handler = this.editorOperations[event.param]; + if(handler) { + handler.call(this,event,operation); + } + // Execute the operation via the engine + var newText = this.engine.executeTextOperation(operation); + // Fix the tiddler height and save changes + this.engine.fixHeight(); + this.saveChanges(newText); + }; + + /* + Compute the internal state of the widget + */ + EditTextWidget.prototype.execute = function() { + // Get our parameters + this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); + this.editField = this.getAttribute("field","text"); + this.editIndex = this.getAttribute("index"); + this.editDefault = this.getAttribute("default"); + this.editClass = this.getAttribute("class"); + this.editPlaceholder = this.getAttribute("placeholder"); + this.editSize = this.getAttribute("size"); + this.editRows = this.getAttribute("rows"); + this.editAutoHeight = this.wiki.getTiddlerText(HEIGHT_MODE_TITLE,"auto"); + this.editAutoHeight = this.getAttribute("autoHeight",this.editAutoHeight === "auto" ? "yes" : "no") === "yes"; + this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT); + this.editFocusPopup = this.getAttribute("focusPopup"); + this.editFocus = this.getAttribute("focus"); + // Get the default editor element tag and type + var tag,type; + if(this.editField === "text") { + tag = "textarea"; + } else { + tag = "input"; + var fieldModule = $tw.Tiddler.fieldModules[this.editField]; + if(fieldModule && fieldModule.editTag) { + tag = fieldModule.editTag; + } + if(fieldModule && fieldModule.editType) { + type = fieldModule.editType; + } + type = type || "text"; + } + // Get the rest of our parameters + this.editTag = this.getAttribute("tag",tag); + this.editType = this.getAttribute("type",type); + // Make the child widgets + this.makeChildWidgets(); + // Determine whether to show the toolbar + this.editShowToolbar = !!(this.children && this.children.length > 0); + }; + + /* + Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering + */ + EditTextWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + // Completely rerender if any of our attributes have changed + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows || changedTiddlers[HEIGHT_MODE_TITLE]) { + this.refreshSelf(); + return true; + } else if(changedTiddlers[this.editTitle]) { + var editInfo = this.getEditInfo(); + this.updateEditor(editInfo.value,editInfo.type); + } + this.engine.fixHeight(); + return this.refreshChildren(changedTiddlers); + }; + + /* + Update the editor with new text. This method is separate from updateEditorDomNode() + so that subclasses can override updateEditor() and still use updateEditorDomNode() + */ + EditTextWidget.prototype.updateEditor = function(text,type) { + this.updateEditorDomNode(text,type); + }; + + /* + Update the editor dom node with new text + */ + EditTextWidget.prototype.updateEditorDomNode = function(text,type) { + this.engine.setText(text,type); + }; + + /* + Save changes back to the tiddler store + */ + EditTextWidget.prototype.saveChanges = function(text) { + var editInfo = this.getEditInfo(); + if(text !== editInfo.value) { + editInfo.update(text); + } + }; + + /* + Handle a dom "keydown" event, which we'll bubble up to our container for the keyboard widgets benefit + */ + EditTextWidget.prototype.handleKeydownEvent = function(event) { + // Check for a keyboard shortcut + if(this.toolbarNode) { + var shortcutElements = this.toolbarNode.querySelectorAll("[data-tw-keyboard-shortcut]"); + for(var index=0; index<shortcutElements.length; index++) { + var el = shortcutElements[index], + shortcutData = el.getAttribute("data-tw-keyboard-shortcut"), + keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(shortcutData,{ + wiki: this.wiki + }); + if($tw.keyboardManager.checkKeyDescriptors(event,keyInfoArray)) { + var clickEvent = this.document.createEvent("Events"); + clickEvent.initEvent("click",true,false); + el.dispatchEvent(clickEvent); + event.preventDefault(); + event.stopPropagation(); + return true; + } + } + } + // Propogate the event to the container + if(this.propogateKeydownEvent(event)) { + // Ignore the keydown if it was already handled + event.preventDefault(); + event.stopPropagation(); + return true; + } + // Otherwise, process the keydown normally + return false; + }; + + /* + Propogate keydown events to our container for the keyboard widgets benefit + */ + EditTextWidget.prototype.propogateKeydownEvent = function(event) { + var newEvent = this.document.createEventObject ? this.document.createEventObject() : this.document.createEvent("Events"); + if(newEvent.initEvent) { + newEvent.initEvent("keydown", true, true); + } + newEvent.keyCode = event.keyCode; + newEvent.which = event.which; + newEvent.metaKey = event.metaKey; + newEvent.ctrlKey = event.ctrlKey; + newEvent.altKey = event.altKey; + newEvent.shiftKey = event.shiftKey; + return !this.parentDomNode.dispatchEvent(newEvent); + }; + + /* + Execute the specified command on the current engine + */ + EditTextWidget.prototype.execCommand = function(command /*, <args> */) { + this.engine.execCommand.apply(this.engine,Array.prototype.slice.call(arguments,0)); + }; + + return EditTextWidget; + +} + +exports.editTextWidgetFactory = editTextWidgetFactory; + +})(); diff --git a/core/modules/editor/operations/bitmap/clear.js b/core/modules/editor/operations/bitmap/clear.js new file mode 100644 index 000000000..cb86b43a1 --- /dev/null +++ b/core/modules/editor/operations/bitmap/clear.js @@ -0,0 +1,24 @@ +/*\ +title: $:/core/modules/editor/operations/bitmap/clear.js +type: application/javascript +module-type: bitmapeditoroperation + +Bitmap editor operation to clear the image + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["clear"] = function(event) { + var ctx = this.canvasDomNode.getContext("2d"); + ctx.globalAlpha = 1; + ctx.fillStyle = event.paramObject.colour || "white"; + ctx.fillRect(0,0,this.canvasDomNode.width,this.canvasDomNode.height); + // Save changes + this.strokeEnd(); +}; + +})(); diff --git a/core/modules/editor/operations/bitmap/resize.js b/core/modules/editor/operations/bitmap/resize.js new file mode 100644 index 000000000..12059a5cb --- /dev/null +++ b/core/modules/editor/operations/bitmap/resize.js @@ -0,0 +1,29 @@ +/*\ +title: $:/core/modules/editor/operations/bitmap/resize.js +type: application/javascript +module-type: bitmapeditoroperation + +Bitmap editor operation to resize the image + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["resize"] = function(event) { + // Get the new width + var newWidth = parseInt(event.paramObject.width || this.canvasDomNode.width,10), + newHeight = parseInt(event.paramObject.height || this.canvasDomNode.height,10); + // Update if necessary + if(newWidth > 0 && newHeight > 0 && !(newWidth === this.currCanvas.width && newHeight === this.currCanvas.height)) { + this.changeCanvasSize(newWidth,newHeight); + } + // Update the input controls + this.refreshToolbar(); + // Save the image into the tiddler + this.saveChanges(); +}; + +})(); diff --git a/core/modules/editor/operations/text/excise.js b/core/modules/editor/operations/text/excise.js new file mode 100644 index 000000000..ced771719 --- /dev/null +++ b/core/modules/editor/operations/text/excise.js @@ -0,0 +1,49 @@ +/*\ +title: $:/core/modules/editor/operations/text/excise.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to excise the selection to a new tiddler + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["excise"] = function(event,operation) { + var editTiddler = this.wiki.getTiddler(this.editTitle), + editTiddlerTitle = this.editTitle; + if(editTiddler && editTiddler.fields["draft.of"]) { + editTiddlerTitle = editTiddler.fields["draft.of"]; + } + var excisionTitle = event.paramObject.title || this.wiki.generateNewTitle("New Excision"); + this.wiki.addTiddler(new $tw.Tiddler( + this.wiki.getCreationFields(), + this.wiki.getModificationFields(), + { + title: excisionTitle, + text: operation.selection, + tags: event.paramObject.tagnew === "yes" ? [editTiddlerTitle] : [] + } + )); + operation.replacement = excisionTitle; + switch(event.paramObject.type || "transclude") { + case "transclude": + operation.replacement = "{{" + operation.replacement+ "}}"; + break; + case "link": + operation.replacement = "[[" + operation.replacement+ "]]"; + break; + case "macro": + operation.replacement = "<<" + (event.paramObject.macro || "translink") + " \"\"\"" + operation.replacement + "\"\"\">>"; + break; + } + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; +}; + +})(); diff --git a/core/modules/editor/operations/text/prefix-lines.js b/core/modules/editor/operations/text/prefix-lines.js new file mode 100644 index 000000000..6d065298b --- /dev/null +++ b/core/modules/editor/operations/text/prefix-lines.js @@ -0,0 +1,59 @@ +/*\ +title: $:/core/modules/editor/operations/text/prefix-lines.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to add a prefix to the selected lines + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["prefix-lines"] = function(event,operation) { + // Cut just past the preceding line break, or the start of the text + operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart); + // Cut to just past the following line break, or to the end of the text + operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd); + // Process each line + var lines = operation.text.substring(operation.cutStart,operation.cutEnd).split(/\r?\n/mg); + $tw.utils.each(lines,function(line,index) { + // Compose the required prefix + var prefix = event.paramObject.character.repeat(event.paramObject.count); + // Check if we already have the required prefix + if(line.substring(0,prefix.length) === prefix) { + // If so, remove the prefix + line = line.substring(prefix.length); + // Remove any whitespace + while(line.charAt(0) === " ") { + line = line.substring(1); + } + } else { + // If we didn't have the prefix, remove any existing prefix characters + while(line.charAt(0) === event.paramObject.character) { + line = line.substring(1); + } + // Remove any whitespace + while(line.charAt(0) === " ") { + line = line.substring(1); + } + // Apply the prefix + line = prefix + " " + line; + } + // Save the modified line + lines[index] = line; + }); + // Stitch the replacement text together and set the selection + operation.replacement = lines.join("\n"); + if(lines.length === 1) { + operation.newSelStart = operation.cutStart + operation.replacement.length; + operation.newSelEnd = operation.newSelStart; + } else { + operation.newSelStart = operation.cutStart; + operation.newSelEnd = operation.newSelStart + operation.replacement.length; + } +}; + +})(); diff --git a/core/modules/editor/operations/text/redo.js b/core/modules/editor/operations/text/redo.js new file mode 100644 index 000000000..3fca21b8d --- /dev/null +++ b/core/modules/editor/operations/text/redo.js @@ -0,0 +1,19 @@ +/*\ +title: $:/core/modules/editor/operations/text/redo.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to tell the browser to perform an redo + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["redo"] = function(event,operation) { + this.execCommand("redo"); +}; + +})(); diff --git a/core/modules/editor/operations/text/replace-all.js b/core/modules/editor/operations/text/replace-all.js new file mode 100644 index 000000000..fc1541935 --- /dev/null +++ b/core/modules/editor/operations/text/replace-all.js @@ -0,0 +1,23 @@ +/*\ +title: $:/core/modules/editor/operations/text/replace-all.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to replace the entire text + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["replace-all"] = function(event,operation) { + operation.cutStart = 0; + operation.cutEnd = operation.text.length; + operation.replacement = event.paramObject.text; + operation.newSelStart = 0; + operation.newSelEnd = operation.replacement.length; +}; + +})(); diff --git a/core/modules/editor/operations/text/replace-selection.js b/core/modules/editor/operations/text/replace-selection.js new file mode 100644 index 000000000..740a41fb1 --- /dev/null +++ b/core/modules/editor/operations/text/replace-selection.js @@ -0,0 +1,23 @@ +/*\ +title: $:/core/modules/editor/operations/text/replace-selection.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to replace the selection + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["replace-selection"] = function(event,operation) { + operation.replacement = event.paramObject.text; + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; +}; + +})(); diff --git a/core/modules/editor/operations/text/undo.js b/core/modules/editor/operations/text/undo.js new file mode 100644 index 000000000..e440142dc --- /dev/null +++ b/core/modules/editor/operations/text/undo.js @@ -0,0 +1,19 @@ +/*\ +title: $:/core/modules/editor/operations/text/undo.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to tell the browser to perform an undo + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["undo"] = function(event,operation) { + this.execCommand("undo"); +}; + +})(); diff --git a/core/modules/editor/operations/text/wrap-lines.js b/core/modules/editor/operations/text/wrap-lines.js new file mode 100644 index 000000000..521811f50 --- /dev/null +++ b/core/modules/editor/operations/text/wrap-lines.js @@ -0,0 +1,28 @@ +/*\ +title: $:/core/modules/editor/operations/text/wrap-lines.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to wrap the selected lines with a prefix and suffix + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["wrap-lines"] = function(event,operation) { + // Cut just past the preceding line break, or the start of the text + operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart); + // Cut to just past the following line break, or to the end of the text + operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd); + // Add the prefix and suffix + operation.replacement = event.paramObject.prefix + "\n" + + operation.text.substring(operation.cutStart,operation.cutEnd) + "\n" + + event.paramObject.suffix + "\n"; + operation.newSelStart = operation.cutStart + event.paramObject.prefix.length + 1; + operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart); +}; + +})(); diff --git a/core/modules/editor/operations/text/wrap-selection.js b/core/modules/editor/operations/text/wrap-selection.js new file mode 100644 index 000000000..30e41e841 --- /dev/null +++ b/core/modules/editor/operations/text/wrap-selection.js @@ -0,0 +1,52 @@ +/*\ +title: $:/core/modules/editor/operations/text/wrap-selection.js +type: application/javascript +module-type: texteditoroperation + +Text editor operation to wrap the selection with the specified prefix and suffix + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["wrap-selection"] = function(event,operation) { + if(operation.selStart === operation.selEnd) { + // No selection; check if we're within the prefix/suffix + if(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) { + // Remove the prefix and suffix unless they comprise the entire text + if(operation.selStart > event.paramObject.prefix.length || (operation.selEnd + event.paramObject.suffix.length) < operation.text.length ) { + operation.cutStart = operation.selStart - event.paramObject.prefix.length; + operation.cutEnd = operation.selEnd + event.paramObject.suffix.length; + operation.replacement = ""; + operation.newSelStart = operation.cutStart; + operation.newSelEnd = operation.newSelStart; + } + } else { + // Wrap the cursor instead + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.replacement = event.paramObject.prefix + event.paramObject.suffix; + operation.newSelStart = operation.selStart + event.paramObject.prefix.length; + operation.newSelEnd = operation.newSelStart; + } + } else if(operation.text.substring(operation.selStart,operation.selStart + event.paramObject.prefix.length) === event.paramObject.prefix && operation.text.substring(operation.selEnd - event.paramObject.suffix.length,operation.selEnd) === event.paramObject.suffix) { + // Prefix and suffix are already present, so remove them + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.replacement = operation.selection.substring(event.paramObject.prefix.length,operation.selection.length - event.paramObject.suffix.length); + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; + } else { + // Add the prefix and suffix + operation.cutStart = operation.selStart; + operation.cutEnd = operation.selEnd; + operation.replacement = event.paramObject.prefix + operation.selection + event.paramObject.suffix; + operation.newSelStart = operation.selStart; + operation.newSelEnd = operation.selStart + operation.replacement.length; + } +}; + +})(); diff --git a/core/modules/keyboard.js b/core/modules/keyboard.js new file mode 100644 index 000000000..bfa76d7e2 --- /dev/null +++ b/core/modules/keyboard.js @@ -0,0 +1,279 @@ +/*\ +title: $:/core/modules/keyboard.js +type: application/javascript +module-type: global + +Keyboard handling utilities + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var namedKeys = { + "cancel": 3, + "help": 6, + "backspace": 8, + "tab": 9, + "clear": 12, + "return": 13, + "enter": 13, + "pause": 19, + "escape": 27, + "space": 32, + "page_up": 33, + "page_down": 34, + "end": 35, + "home": 36, + "left": 37, + "up": 38, + "right": 39, + "down": 40, + "printscreen": 44, + "insert": 45, + "delete": 46, + "0": 48, + "1": 49, + "2": 50, + "3": 51, + "4": 52, + "5": 53, + "6": 54, + "7": 55, + "8": 56, + "9": 57, + "firefoxsemicolon": 59, + "firefoxequals": 61, + "a": 65, + "b": 66, + "c": 67, + "d": 68, + "e": 69, + "f": 70, + "g": 71, + "h": 72, + "i": 73, + "j": 74, + "k": 75, + "l": 76, + "m": 77, + "n": 78, + "o": 79, + "p": 80, + "q": 81, + "r": 82, + "s": 83, + "t": 84, + "u": 85, + "v": 86, + "w": 87, + "x": 88, + "y": 89, + "z": 90, + "numpad0": 96, + "numpad1": 97, + "numpad2": 98, + "numpad3": 99, + "numpad4": 100, + "numpad5": 101, + "numpad6": 102, + "numpad7": 103, + "numpad8": 104, + "numpad9": 105, + "multiply": 106, + "add": 107, + "separator": 108, + "subtract": 109, + "decimal": 110, + "divide": 111, + "f1": 112, + "f2": 113, + "f3": 114, + "f4": 115, + "f5": 116, + "f6": 117, + "f7": 118, + "f8": 119, + "f9": 120, + "f10": 121, + "f11": 122, + "f12": 123, + "f13": 124, + "f14": 125, + "f15": 126, + "f16": 127, + "f17": 128, + "f18": 129, + "f19": 130, + "f20": 131, + "f21": 132, + "f22": 133, + "f23": 134, + "f24": 135, + "firefoxminus": 173, + "semicolon": 186, + "equals": 187, + "comma": 188, + "dash": 189, + "period": 190, + "slash": 191, + "backquote": 192, + "openbracket": 219, + "backslash": 220, + "closebracket": 221, + "quote": 222 +}; + +function KeyboardManager(options) { + var self = this; + options = options || ""; + // Save the named key hashmap + this.namedKeys = namedKeys; + // Create a reverse mapping of code to keyname + this.keyNames = []; + $tw.utils.each(namedKeys,function(keyCode,name) { + self.keyNames[keyCode] = name.substr(0,1).toUpperCase() + name.substr(1); + }); + // Save the platform-specific name of the "meta" key + this.metaKeyName = $tw.platform.isMac ? "cmd-" : "win-"; +} + +/* +Return an array of keycodes for the modifier keys ctrl, shift, alt, meta +*/ +KeyboardManager.prototype.getModifierKeys = function() { + return [ + 16, // Shift + 17, // Ctrl + 18, // Alt + 20, // CAPS LOCK + 91, // Meta (left) + 93, // Meta (right) + 224 // Meta (Firefox) + ] +}; + +/* +Parses a key descriptor into the structure: +{ + keyCode: numeric keycode + shiftKey: boolean + altKey: boolean + ctrlKey: boolean + metaKey: boolean +} +Key descriptors have the following format: + ctrl+enter + ctrl+shift+alt+A +*/ +KeyboardManager.prototype.parseKeyDescriptor = function(keyDescriptor) { + var components = keyDescriptor.split(/\+|\-/), + info = { + keyCode: 0, + shiftKey: false, + altKey: false, + ctrlKey: false, + metaKey: false + }; + for(var t=0; t<components.length; t++) { + var s = components[t].toLowerCase(), + c = s.charCodeAt(0); + // Look for modifier keys + if(s === "ctrl") { + info.ctrlKey = true; + } else if(s === "shift") { + info.shiftKey = true; + } else if(s === "alt") { + info.altKey = true; + } else if(s === "meta" || s === "cmd" || s === "win") { + info.metaKey = true; + } + // Replace named keys with their code + if(this.namedKeys[s]) { + info.keyCode = this.namedKeys[s]; + } + } + if(info.keyCode) { + return info; + } else { + return null; + } +}; + +/* +Parse a list of key descriptors into an array of keyInfo objects. The key descriptors can be passed as an array of strings or a space separated string +*/ +KeyboardManager.prototype.parseKeyDescriptors = function(keyDescriptors,options) { + var self = this; + options = options || {}; + options.stack = options.stack || []; + var wiki = options.wiki || $tw.wiki; + if(typeof keyDescriptors === "string" && keyDescriptors === "") { + return []; + } + if(!$tw.utils.isArray(keyDescriptors)) { + keyDescriptors = keyDescriptors.split(" "); + } + var result = []; + $tw.utils.each(keyDescriptors,function(keyDescriptor) { + // Look for a named shortcut + if(keyDescriptor.substr(0,2) === "((" && keyDescriptor.substr(-2,2) === "))") { + if(options.stack.indexOf(keyDescriptor) === -1) { + options.stack.push(keyDescriptor); + var name = keyDescriptor.substring(2,keyDescriptor.length - 2), + lookupName = function(configName) { + var keyDescriptors = wiki.getTiddlerText("$:/config/" + configName + "/" + name); + if(keyDescriptors) { + result.push.apply(result,self.parseKeyDescriptors(keyDescriptors,options)); + } + }; + lookupName("shortcuts"); + lookupName($tw.platform.isMac ? "shortcuts-mac" : "shortcuts-not-mac"); + lookupName($tw.platform.isWindows ? "shortcuts-windows" : "shortcuts-not-windows"); + lookupName($tw.platform.isLinux ? "shortcuts-linux" : "shortcuts-not-linux"); + } + } else { + result.push(self.parseKeyDescriptor(keyDescriptor)); + } + }); + return result; +}; + +KeyboardManager.prototype.getPrintableShortcuts = function(keyInfoArray) { + var self = this, + result = []; + $tw.utils.each(keyInfoArray,function(keyInfo) { + if(keyInfo) { + result.push((keyInfo.ctrlKey ? "ctrl-" : "") + + (keyInfo.shiftKey ? "shift-" : "") + + (keyInfo.altKey ? "alt-" : "") + + (keyInfo.metaKey ? self.metaKeyName : "") + + (self.keyNames[keyInfo.keyCode])); + } + }); + return result; +} + +KeyboardManager.prototype.checkKeyDescriptor = function(event,keyInfo) { + return keyInfo && + event.keyCode === keyInfo.keyCode && + event.shiftKey === keyInfo.shiftKey && + event.altKey === keyInfo.altKey && + event.ctrlKey === keyInfo.ctrlKey && + event.metaKey === keyInfo.metaKey; +}; + +KeyboardManager.prototype.checkKeyDescriptors = function(event,keyInfoArray) { + for(var t=0; t<keyInfoArray.length; t++) { + if(this.checkKeyDescriptor(event,keyInfoArray[t])) { + return true; + } + } + return false; +}; + +exports.KeyboardManager = KeyboardManager; + +})(); diff --git a/core/modules/macros/displayshortcuts.js b/core/modules/macros/displayshortcuts.js new file mode 100644 index 000000000..b18297238 --- /dev/null +++ b/core/modules/macros/displayshortcuts.js @@ -0,0 +1,45 @@ +/*\ +title: $:/core/modules/macros/displayshortcuts.js +type: application/javascript +module-type: macro + +Macro to display a list of keyboard shortcuts in human readable form. Notably, it resolves named shortcuts like `((bold))` to the underlying keystrokes. + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Information about this macro +*/ + +exports.name = "displayshortcuts"; + +exports.params = [ + {name: "shortcuts"}, + {name: "prefix"}, + {name: "separator"}, + {name: "suffix"} +]; + +/* +Run the macro +*/ +exports.run = function(shortcuts,prefix,separator,suffix) { + var shortcutArray = $tw.keyboardManager.getPrintableShortcuts($tw.keyboardManager.parseKeyDescriptors(shortcuts,{ + wiki: this.wiki + })); + if(shortcutArray.length > 0) { + shortcutArray.sort(function(a,b) { + return a.toLowerCase().localeCompare(b.toLowerCase()); + }) + return prefix + shortcutArray.join(separator) + suffix; + } else { + return ""; + } +}; + +})(); diff --git a/core/modules/startup/startup.js b/core/modules/startup/startup.js index 08f9641e3..22fb9d30b 100755 --- a/core/modules/startup/startup.js +++ b/core/modules/startup/startup.js @@ -24,9 +24,33 @@ var widget = require("$:/core/modules/widgets/widget.js"); exports.startup = function() { var modules,n,m,f; + // Minimal browser detection if($tw.browser) { $tw.browser.isIE = (/msie|trident/i.test(navigator.userAgent)); } + // Platform detection + $tw.platform = {}; + if($tw.browser) { + $tw.platform.isMac = /Mac/.test(navigator.platform); + $tw.platform.isWindows = /win/i.test(navigator.platform); + $tw.platform.isLinux = /Linux/i.test(navigator.appVersion); + } else { + switch(require("os").platform()) { + case "darwin": + $tw.platform.isMac = true; + break; + case "win32": + $tw.platform.isWindows = true; + break; + case "freebsd": + $tw.platform.isLinux = true; + break; + case "linux": + $tw.platform.isLinux = true; + break; + } + } + // Initialise version $tw.version = $tw.utils.extractVersionInfo(); // Set up the performance framework $tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,"no") === "yes"); @@ -50,6 +74,8 @@ exports.startup = function() { "$:/themes/tiddlywiki/vanilla" ] }); + // Kick off the keyboard manager + $tw.keyboardManager = new $tw.KeyboardManager(); // Clear outstanding tiddler store change events to avoid an unnecessary refresh cycle at startup $tw.wiki.clearTiddlerEventQueue(); // Create a root widget for attaching event handlers. By using it as the parentWidget for another widget tree, one can reuse the event handlers diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 35f556262..ef08ec369 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -60,6 +60,20 @@ exports.toggleClass = function(el,className,status) { } }; +/* +Get the first parent element that has scrollbars or use the body as fallback. +*/ +exports.getScrollContainer = function(el) { + var doc = el.ownerDocument; + while(el.parentNode) { + el = el.parentNode; + if(el.scrollTop) { + return el; + } + } + return doc.body; +}; + /* Get the scroll position of the viewport Returns: @@ -76,6 +90,31 @@ exports.getScrollPosition = function() { } }; +/* +Adjust the height of a textarea to fit its content, preserving scroll position, and return the height +*/ +exports.resizeTextAreaToFit = function(domNode,minHeight) { + // Get the scroll container and register the current scroll position + var container = $tw.utils.getScrollContainer(domNode), + scrollTop = container.scrollTop; + // Measure the specified minimum height + domNode.style.height = minHeight; + var measuredHeight = domNode.offsetHeight; + // Set its height to auto so that it snaps to the correct height + domNode.style.height = "auto"; + // Calculate the revised height + var newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,measuredHeight); + // Only try to change the height if it has changed + if(newHeight !== domNode.offsetHeight) { + domNode.style.height = newHeight + "px"; + // Make sure that the dimensions of the textarea are recalculated + $tw.utils.forceLayout(domNode); + // Set the container to the position we registered at the beginning + container.scrollTop = scrollTop; + } + return newHeight; +}; + /* Gets the bounding rectangle of an element in absolute page coordinates */ @@ -164,5 +203,30 @@ exports.addEventListeners = function(domNode,events) { }); }; +/* +Get the computed styles applied to an element as an array of strings of individual CSS properties +*/ +exports.getComputedStyles = function(domNode) { + var textAreaStyles = window.getComputedStyle(domNode,null), + styleDefs = []; + $tw.utils.each(Object.keys(textAreaStyles),function(name) { + styleDefs.push(name + ": " + textAreaStyles[name] + ";"); + }); + return styleDefs; +}; + +/* +Apply a set of styles passed as an array of strings of individual CSS properties +*/ +exports.setStyles = function(domNode,styleDefs) { + domNode.style.cssText = styleDefs.join(""); +}; + +/* +Copy the computed styles from a source element to a destination element +*/ +exports.copyStyles = function(srcDomNode,dstDomNode) { + $tw.utils.setStyles(dstDomNode,$tw.utils.getComputedStyles(srcDomNode)); +}; })(); diff --git a/core/modules/utils/dom/keyboard.js b/core/modules/utils/dom/keyboard.js index fda8e012a..0ba1af5a0 100644 --- a/core/modules/utils/dom/keyboard.js +++ b/core/modules/utils/dom/keyboard.js @@ -3,7 +3,7 @@ title: $:/core/modules/utils/dom/keyboard.js type: application/javascript module-type: utils -Keyboard utilities +Keyboard utilities; now deprecated. Instead, use $tw.keyboardManager \*/ (function(){ @@ -12,60 +12,14 @@ Keyboard utilities /*global $tw: false */ "use strict"; -var namedKeys = { - "backspace": 8, - "tab": 9, - "enter": 13, - "escape": 27 -}; - -/* -Parses a key descriptor into the structure: -{ - keyCode: numeric keycode - shiftKey: boolean - altKey: boolean - ctrlKey: boolean -} -Key descriptors have the following format: - ctrl+enter - ctrl+shift+alt+A -*/ -exports.parseKeyDescriptor = function(keyDescriptor) { - var components = keyDescriptor.split("+"), - info = { - keyCode: 0, - shiftKey: false, - altKey: false, - ctrlKey: false - }; - for(var t=0; t<components.length; t++) { - var s = components[t].toLowerCase(); - // Look for modifier keys - if(s === "ctrl") { - info.ctrlKey = true; - } else if(s === "shift") { - info.shiftKey = true; - } else if(s === "alt") { - info.altKey = true; - } else if(s === "meta") { - info.metaKey = true; +["parseKeyDescriptor","checkKeyDescriptor"].forEach(function(method) { + exports[method] = function() { + if($tw.keyboardManager) { + return $tw.keyboardManager[method].apply($tw.keyboardManager,Array.prototype.slice.call(arguments,0)); + } else { + return null } - // Replace named keys with their code - if(namedKeys[s]) { - info.keyCode = namedKeys[s]; - } - } - return info; -}; - -exports.checkKeyDescriptor = function(event,keyInfo) { - var metaKeyStatus = !!keyInfo.metaKey; // Using a temporary variable to keep JSHint happy - return event.keyCode === keyInfo.keyCode && - event.shiftKey === keyInfo.shiftKey && - event.altKey === keyInfo.altKey && - event.ctrlKey === keyInfo.ctrlKey && - event.metaKey === metaKeyStatus; -}; + }; +}); })(); diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js index 2e29a8891..2bea63728 100644 --- a/core/modules/utils/utils.js +++ b/core/modules/utils/utils.js @@ -31,6 +31,39 @@ exports.trim = function(str) { } }; +/* +Find the line break preceding a given position in a string +Returns position immediately after that line break, or the start of the string +*/ +exports.findPrecedingLineBreak = function(text,pos) { + var result = text.lastIndexOf("\n",pos - 1); + if(result === -1) { + result = 0; + } else { + result++; + if(text.charAt(result) === "\r") { + result++; + } + } + return result; +}; + +/* +Find the line break following a given position in a string +*/ +exports.findFollowingLineBreak = function(text,pos) { + // Cut to just past the following line break, or to the end of the text + var result = text.indexOf("\n",pos); + if(result === -1) { + result = text.length; + } else { + if(text.charAt(result) === "\r") { + result++; + } + } + return result; +}; + /* Return the number of keys in an object */ diff --git a/core/modules/widgets/edit-bitmap.js b/core/modules/widgets/edit-bitmap.js index aaac6c696..f094d9464 100644 --- a/core/modules/widgets/edit-bitmap.js +++ b/core/modules/widgets/edit-bitmap.js @@ -13,16 +13,22 @@ Edit-bitmap widget "use strict"; // Default image sizes -var DEFAULT_IMAGE_WIDTH = 300, - DEFAULT_IMAGE_HEIGHT = 185; +var DEFAULT_IMAGE_WIDTH = 600, + DEFAULT_IMAGE_HEIGHT = 370; // Configuration tiddlers var LINE_WIDTH_TITLE = "$:/config/BitmapEditor/LineWidth", - LINE_COLOUR_TITLE = "$:/config/BitmapEditor/Colour"; + LINE_COLOUR_TITLE = "$:/config/BitmapEditor/Colour", + LINE_OPACITY_TITLE = "$:/config/BitmapEditor/Opacity"; var Widget = require("$:/core/modules/widgets/widget.js").widget; var EditBitmapWidget = function(parseTreeNode,options) { + // Initialise the editor operations if they've not been done already + if(!this.editorOperations) { + EditBitmapWidget.prototype.editorOperations = {}; + $tw.modules.applyMethods("bitmapeditoroperation",this.editorOperations); + } this.initialise(parseTreeNode,options); }; @@ -42,7 +48,12 @@ EditBitmapWidget.prototype.render = function(parent,nextSibling) { this.computeAttributes(); // Execute our logic this.execute(); - // Create our element + // Create the wrapper for the toolbar and render its content + this.toolbarNode = this.document.createElement("div"); + this.toolbarNode.className = "tc-editor-toolbar"; + parent.insertBefore(this.toolbarNode,nextSibling); + this.domNodes.push(this.toolbarNode); + // Create the on-screen canvas this.canvasDomNode = $tw.utils.domMaker("canvas",{ document: this.document, "class":"tc-edit-bitmapeditor", @@ -60,29 +71,33 @@ EditBitmapWidget.prototype.render = function(parent,nextSibling) { name: "mouseup", handlerObject: this, handlerMethod: "handleMouseUpEvent" }] }); - this.widthDomNode = $tw.utils.domMaker("input",{ - document: this.document, - "class":"tc-edit-bitmapeditor-width", - eventListeners: [{ - name: "change", handlerObject: this, handlerMethod: "handleWidthChangeEvent" - }] - }); - this.heightDomNode = $tw.utils.domMaker("input",{ - document: this.document, - "class":"tc-edit-bitmapeditor-height", - eventListeners: [{ - name: "change", handlerObject: this, handlerMethod: "handleHeightChangeEvent" - }] - }); - // Insert the elements into the DOM + // Set the width and height variables + this.setVariable("tv-bitmap-editor-width",this.canvasDomNode.width + "px"); + this.setVariable("tv-bitmap-editor-height",this.canvasDomNode.height + "px"); + // Render toolbar child widgets + this.renderChildren(this.toolbarNode,null); + // // Insert the elements into the DOM parent.insertBefore(this.canvasDomNode,nextSibling); - parent.insertBefore(this.widthDomNode,nextSibling); - parent.insertBefore(this.heightDomNode,nextSibling); - this.domNodes.push(this.canvasDomNode,this.widthDomNode,this.heightDomNode); + this.domNodes.push(this.canvasDomNode); // Load the image into the canvas if($tw.browser) { this.loadCanvas(); } + // Add widget message listeners + this.addEventListeners([ + {type: "tm-edit-bitmap-operation", handler: "handleEditBitmapOperationMessage"} + ]); +}; + +/* +Handle an edit bitmap operation message from the toolbar +*/ +EditBitmapWidget.prototype.handleEditBitmapOperationMessage = function(event) { + // Invoke the handler + var handler = this.editorOperations[event.param]; + if(handler) { + handler.call(this,event); + } }; /* @@ -91,13 +106,28 @@ Compute the internal state of the widget EditBitmapWidget.prototype.execute = function() { // Get our parameters this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); + // Make the child widgets + this.makeChildWidgets(); }; /* -Note that the bitmap editor intentionally doesn't try to refresh itself because it would be confusing to have the image changing spontaneously while editting it +Just refresh the toolbar */ EditBitmapWidget.prototype.refresh = function(changedTiddlers) { - return false; + return this.refreshChildren(changedTiddlers); +}; + +/* +Set the bitmap size variables and refresh the toolbar +*/ +EditBitmapWidget.prototype.refreshToolbar = function() { + // Set the width and height variables + this.setVariable("tv-bitmap-editor-width",this.canvasDomNode.width + "px"); + this.setVariable("tv-bitmap-editor-height",this.canvasDomNode.height + "px"); + // Refresh each of our child widgets + $tw.utils.each(this.children,function(childWidget) { + childWidget.refreshSelf(); + }); }; EditBitmapWidget.prototype.loadCanvas = function() { @@ -112,7 +142,7 @@ EditBitmapWidget.prototype.loadCanvas = function() { self.currCanvas = self.document.createElement("canvas"); self.initCanvas(self.currCanvas,currImage.width,currImage.height,currImage); // Set the width and height input boxes - self.updateSize(); + self.refreshToolbar(); }; currImage.onerror = function() { // Set the on-screen canvas size and clear it @@ -121,7 +151,7 @@ EditBitmapWidget.prototype.loadCanvas = function() { self.currCanvas = self.document.createElement("canvas"); self.initCanvas(self.currCanvas,DEFAULT_IMAGE_WIDTH,DEFAULT_IMAGE_HEIGHT); // Set the width and height input boxes - self.updateSize(); + self.refreshToolbar(); }; // Get the current bitmap into an image object currImage.src = "data:" + tiddler.fields.type + ";base64," + tiddler.fields.text; @@ -139,14 +169,6 @@ EditBitmapWidget.prototype.initCanvas = function(canvas,width,height,image) { } }; -/* -** Update the input boxes with the actual size of the canvas -*/ -EditBitmapWidget.prototype.updateSize = function() { - this.widthDomNode.value = this.currCanvas.width; - this.heightDomNode.value = this.currCanvas.height; -}; - /* ** Change the size of the canvas, preserving the current image */ @@ -167,28 +189,6 @@ EditBitmapWidget.prototype.changeCanvasSize = function(newWidth,newHeight) { ctx.drawImage(this.currCanvas,0,0); }; -EditBitmapWidget.prototype.handleWidthChangeEvent = function(event) { - // Get the new width - var newWidth = parseInt(this.widthDomNode.value,10); - // Update if necessary - if(newWidth > 0 && newWidth !== this.currCanvas.width) { - this.changeCanvasSize(newWidth,this.currCanvas.height); - } - // Update the input controls - this.updateSize(); -}; - -EditBitmapWidget.prototype.handleHeightChangeEvent = function(event) { - // Get the new width - var newHeight = parseInt(this.heightDomNode.value,10); - // Update if necessary - if(newHeight > 0 && newHeight !== this.currCanvas.height) { - this.changeCanvasSize(this.currCanvas.width,newHeight); - } - // Update the input controls - this.updateSize(); -}; - EditBitmapWidget.prototype.handleTouchStartEvent = function(event) { this.brushDown = true; this.strokeStart(event.touches[0].clientX,event.touches[0].clientY); @@ -264,8 +264,9 @@ EditBitmapWidget.prototype.strokeMove = function(x,y) { // Redraw the previous image ctx.drawImage(this.currCanvas,0,0); // Render the stroke + ctx.globalAlpha = parseFloat(this.wiki.getTiddlerText(LINE_OPACITY_TITLE,"1.0")); ctx.strokeStyle = this.wiki.getTiddlerText(LINE_COLOUR_TITLE,"#ff0"); - ctx.lineWidth = parseInt(this.wiki.getTiddlerText(LINE_WIDTH_TITLE,"3"),10); + ctx.lineWidth = parseFloat(this.wiki.getTiddlerText(LINE_WIDTH_TITLE,"3")); ctx.lineCap = "round"; ctx.lineJoin = "round"; ctx.beginPath(); @@ -292,7 +293,7 @@ EditBitmapWidget.prototype.saveChanges = function() { var tiddler = this.wiki.getTiddler(this.editTitle); if(tiddler) { // data URIs look like "data:<type>;base64,<text>" - var dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type,1.0), + var dataURL = this.canvasDomNode.toDataURL(tiddler.fields.type), posColon = dataURL.indexOf(":"), posSemiColon = dataURL.indexOf(";"), posComma = dataURL.indexOf(","), diff --git a/core/modules/widgets/edit-shortcut.js b/core/modules/widgets/edit-shortcut.js new file mode 100644 index 000000000..78f34839c --- /dev/null +++ b/core/modules/widgets/edit-shortcut.js @@ -0,0 +1,139 @@ +/*\ +title: $:/core/modules/widgets/edit-shortcut.js +type: application/javascript +module-type: widget + +Widget to display an editable keyboard shortcut + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var EditShortcutWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +EditShortcutWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +EditShortcutWidget.prototype.render = function(parent,nextSibling) { + this.parentDomNode = parent; + this.computeAttributes(); + this.execute(); + this.inputNode = this.document.createElement("input"); + // Assign classes + if(this.shortcutClass) { + this.inputNode.className = this.shortcutClass; + } + // Assign other attributes + if(this.shortcutStyle) { + this.inputNode.setAttribute("style",this.shortcutStyle); + } + if(this.shortcutTooltip) { + this.inputNode.setAttribute("title",this.shortcutTooltip); + } + if(this.shortcutPlaceholder) { + this.inputNode.setAttribute("placeholder",this.shortcutPlaceholder); + } + if(this.shortcutAriaLabel) { + this.inputNode.setAttribute("aria-label",this.shortcutAriaLabel); + } + // Assign the current shortcut + this.updateInputNode(); + // Add event handlers + $tw.utils.addEventListeners(this.inputNode,[ + {name: "keydown", handlerObject: this, handlerMethod: "handleKeydownEvent"} + ]); + // Link into the DOM + parent.insertBefore(this.inputNode,nextSibling); + this.domNodes.push(this.inputNode); +}; + +/* +Compute the internal state of the widget +*/ +EditShortcutWidget.prototype.execute = function() { + this.shortcutTiddler = this.getAttribute("tiddler"); + this.shortcutField = this.getAttribute("field"); + this.shortcutIndex = this.getAttribute("index"); + this.shortcutPlaceholder = this.getAttribute("placeholder"); + this.shortcutDefault = this.getAttribute("default",""); + this.shortcutClass = this.getAttribute("class"); + this.shortcutStyle = this.getAttribute("style"); + this.shortcutTooltip = this.getAttribute("tooltip"); + this.shortcutAriaLabel = this.getAttribute("aria-label"); +}; + +/* +Update the value of the input node +*/ +EditShortcutWidget.prototype.updateInputNode = function() { + if(this.shortcutField) { + var tiddler = this.wiki.getTiddler(this.shortcutTiddler); + if(tiddler && $tw.utils.hop(tiddler.fields,this.shortcutField)) { + this.inputNode.value = tiddler.getFieldString(this.shortcutField); + } else { + this.inputNode.value = this.shortcutDefault; + } + } else if(this.shortcutIndex) { + this.inputNode.value = this.wiki.extractTiddlerDataItem(this.shortcutTiddler,this.shortcutIndex,this.shortcutDefault); + } else { + this.inputNode.value = this.wiki.getTiddlerText(this.shortcutTiddler,this.shortcutDefault); + } +}; + +/* +Handle a dom "keydown" event +*/ +EditShortcutWidget.prototype.handleKeydownEvent = function(event) { + // Ignore shift, ctrl, meta, alt + if(event.keyCode && $tw.keyboardManager.getModifierKeys().indexOf(event.keyCode) === -1) { + // Get the shortcut text representation + var value = $tw.keyboardManager.getPrintableShortcuts([{ + ctrlKey: event.ctrlKey, + shiftKey: event.shiftKey, + altKey: event.altKey, + metaKey: event.metaKey, + keyCode: event.keyCode + }]); + if(value.length > 0) { + this.wiki.setText(this.shortcutTiddler,this.shortcutField,this.shortcutIndex,value[0]); + } + // Ignore the keydown if it was already handled + event.preventDefault(); + event.stopPropagation(); + return true; + } else { + return false; + } +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget needed re-rendering +*/ +EditShortcutWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.placeholder || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.style || changedAttributes.tooltip || changedAttributes["aria-label"]) { + this.refreshSelf(); + return true; + } else if(changedTiddlers[this.shortcutTiddler]) { + this.updateInputNode(); + return true; + } else { + return false; + } +}; + +exports["edit-shortcut"] = EditShortcutWidget; + +})(); diff --git a/core/modules/widgets/edit-text.js b/core/modules/widgets/edit-text.js index c0588f93c..bc7b77490 100644 --- a/core/modules/widgets/edit-text.js +++ b/core/modules/widgets/edit-text.js @@ -12,280 +12,10 @@ Edit-text widget /*global $tw: false */ "use strict"; -var DEFAULT_MIN_TEXT_AREA_HEIGHT = "100px"; // Minimum height of textareas in pixels +var editTextWidgetFactory = require("$:/core/modules/editor/factory.js").editTextWidgetFactory, + FramedEngine = require("$:/core/modules/editor/engines/framed.js").FramedEngine, + SimpleEngine = require("$:/core/modules/editor/engines/simple.js").SimpleEngine; -var Widget = require("$:/core/modules/widgets/widget.js").widget; - -var EditTextWidget = function(parseTreeNode,options) { - this.initialise(parseTreeNode,options); -}; - -/* -Inherit from the base widget class -*/ -EditTextWidget.prototype = new Widget(); - -/* -Render this widget into the DOM -*/ -EditTextWidget.prototype.render = function(parent,nextSibling) { - var self = this; - // Save the parent dom node - this.parentDomNode = parent; - // Compute our attributes - this.computeAttributes(); - // Execute our logic - this.execute(); - // Create our element - var editInfo = this.getEditInfo(), - tag = this.editTag; - if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) { - tag = "input"; - } - var domNode = this.document.createElement(tag); - if(this.editType) { - domNode.setAttribute("type",this.editType); - } - if(editInfo.value === "" && this.editPlaceholder) { - domNode.setAttribute("placeholder",this.editPlaceholder); - } - if(this.editSize) { - domNode.setAttribute("size",this.editSize); - } - if(this.editRows) { - domNode.setAttribute("rows",this.editRows); - } - // Assign classes - if(this.editClass) { - domNode.className = this.editClass; - } - // Set the text - if(this.editTag === "textarea") { - domNode.appendChild(this.document.createTextNode(editInfo.value)); - } else { - domNode.value = editInfo.value; - } - // Add an input event handler - $tw.utils.addEventListeners(domNode,[ - {name: "focus", handlerObject: this, handlerMethod: "handleFocusEvent"}, - {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"} - ]); - // Insert the element into the DOM - parent.insertBefore(domNode,nextSibling); - this.domNodes.push(domNode); - if(this.postRender) { - this.postRender(); - } - // Fix height - this.fixHeight(); - // Focus field - if(this.editFocus === "true") { - if(domNode.focus && domNode.select) { - domNode.focus(); - domNode.select(); - } - } -}; - -/* -Get the tiddler being edited and current value -*/ -EditTextWidget.prototype.getEditInfo = function() { - // Get the edit value - var self = this, - value, - update; - if(this.editIndex) { - value = this.wiki.extractTiddlerDataItem(this.editTitle,this.editIndex,this.editDefault); - update = function(value) { - var data = self.wiki.getTiddlerData(self.editTitle,{}); - if(data[self.editIndex] !== value) { - data[self.editIndex] = value; - self.wiki.setTiddlerData(self.editTitle,data); - } - }; - } else { - // Get the current tiddler and the field name - var tiddler = this.wiki.getTiddler(this.editTitle); - if(tiddler) { - // If we've got a tiddler, the value to display is the field string value - value = tiddler.getFieldString(this.editField); - } else { - // Otherwise, we need to construct a default value for the editor - switch(this.editField) { - case "text": - value = "Type the text for the tiddler '" + this.editTitle + "'"; - break; - case "title": - value = this.editTitle; - break; - default: - value = ""; - break; - } - if(this.editDefault !== undefined) { - value = this.editDefault; - } - } - update = function(value) { - var tiddler = self.wiki.getTiddler(self.editTitle), - updateFields = { - title: self.editTitle - }; - updateFields[self.editField] = value; - self.wiki.addTiddler(new $tw.Tiddler(self.wiki.getCreationFields(),tiddler,updateFields,self.wiki.getModificationFields())); - }; - } - return {value: value, update: update}; -}; - -/* -Compute the internal state of the widget -*/ -EditTextWidget.prototype.execute = function() { - // Get our parameters - this.editTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); - this.editField = this.getAttribute("field","text"); - this.editIndex = this.getAttribute("index"); - this.editDefault = this.getAttribute("default"); - this.editClass = this.getAttribute("class"); - this.editPlaceholder = this.getAttribute("placeholder"); - this.editSize = this.getAttribute("size"); - this.editRows = this.getAttribute("rows"); - this.editAutoHeight = this.getAttribute("autoHeight","yes") === "yes"; - this.editMinHeight = this.getAttribute("minHeight",DEFAULT_MIN_TEXT_AREA_HEIGHT); - this.editFocusPopup = this.getAttribute("focusPopup"); - this.editFocus = this.getAttribute("focus"); - // Get the editor element tag and type - var tag,type; - if(this.editField === "text") { - tag = "textarea"; - } else { - tag = "input"; - var fieldModule = $tw.Tiddler.fieldModules[this.editField]; - if(fieldModule && fieldModule.editTag) { - tag = fieldModule.editTag; - } - if(fieldModule && fieldModule.editType) { - type = fieldModule.editType; - } - type = type || "text"; - } - // Get the rest of our parameters - this.editTag = this.getAttribute("tag",tag); - this.editType = this.getAttribute("type",type); -}; - -/* -Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering -*/ -EditTextWidget.prototype.refresh = function(changedTiddlers) { - var changedAttributes = this.computeAttributes(); - // Completely rerender if any of our attributes have changed - if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes["default"] || changedAttributes["class"] || changedAttributes.placeholder || changedAttributes.size || changedAttributes.autoHeight || changedAttributes.minHeight || changedAttributes.focusPopup || changedAttributes.rows) { - this.refreshSelf(); - return true; - } else if(changedTiddlers[this.editTitle]) { - this.updateEditor(this.getEditInfo().value); - return true; - } - // Fix the height anyway in case there has been a reflow - this.fixHeight(); - return false; -}; - -/* -Update the editor with new text. This method is separate from updateEditorDomNode() -so that subclasses can override updateEditor() and still use updateEditorDomNode() -*/ -EditTextWidget.prototype.updateEditor = function(text) { - this.updateEditorDomNode(text); -}; - -/* -Update the editor dom node with new text -*/ -EditTextWidget.prototype.updateEditorDomNode = function(text) { - // Replace the edit value if the tiddler we're editing has changed - var domNode = this.domNodes[0]; - if(!domNode.isTiddlyWikiFakeDom) { - if(this.document.activeElement !== domNode) { - domNode.value = text; - } - // Fix the height if needed - this.fixHeight(); - } -}; - -/* -Get the first parent element that has scrollbars or use the body as fallback. -*/ -EditTextWidget.prototype.getScrollContainer = function(el) { - while(el.parentNode) { - el = el.parentNode; - if(el.scrollTop) { - return el; - } - } - return this.document.body; -}; - -/* -Fix the height of textareas to fit their content -*/ -EditTextWidget.prototype.fixHeight = function() { - var domNode = this.domNodes[0]; - if(this.editAutoHeight && domNode && !domNode.isTiddlyWikiFakeDom && this.editTag === "textarea") { - // Resize the textarea to fit its content, preserving scroll position - // Get the scroll container and register the current scroll position - var container = this.getScrollContainer(domNode), - scrollTop = container.scrollTop; - // Measure the specified minimum height - domNode.style.height = this.editMinHeight; - var minHeight = domNode.offsetHeight; - // Set its height to auto so that it snaps to the correct height - domNode.style.height = "auto"; - // Calculate the revised height - var newHeight = Math.max(domNode.scrollHeight + domNode.offsetHeight - domNode.clientHeight,minHeight); - // Only try to change the height if it has changed - if(newHeight !== domNode.offsetHeight) { - domNode.style.height = newHeight + "px"; - // Make sure that the dimensions of the textarea are recalculated - $tw.utils.forceLayout(domNode); - // Set the container to the position we registered at the beginning - container.scrollTop = scrollTop; - } - } -}; - -/* -Handle a dom "input" event -*/ -EditTextWidget.prototype.handleInputEvent = function(event) { - this.saveChanges(this.domNodes[0].value); - this.fixHeight(); - return true; -}; - -EditTextWidget.prototype.handleFocusEvent = function(event) { - if(this.editFocusPopup) { - $tw.popup.triggerPopup({ - domNode: this.domNodes[0], - title: this.editFocusPopup, - wiki: this.wiki, - force: true - }); - } - return true; -}; - -EditTextWidget.prototype.saveChanges = function(text) { - var editInfo = this.getEditInfo(); - if(text !== editInfo.value) { - editInfo.update(text); - } -}; - -exports["edit-text"] = EditTextWidget; +exports["edit-text"] = editTextWidgetFactory(FramedEngine,SimpleEngine); })(); diff --git a/core/modules/widgets/edit.js b/core/modules/widgets/edit.js index 38b676e57..ebcc775ca 100644 --- a/core/modules/widgets/edit.js +++ b/core/modules/widgets/edit.js @@ -57,7 +57,8 @@ EditWidget.prototype.execute = function() { index: {type: "string", value: this.editIndex}, "class": {type: "string", value: this.editClass}, "placeholder": {type: "string", value: this.editPlaceholder} - } + }, + children: this.parseTreeNode.children }]); }; diff --git a/core/modules/widgets/entity.js b/core/modules/widgets/entity.js index 7e2b9dc66..5c885baea 100755 --- a/core/modules/widgets/entity.js +++ b/core/modules/widgets/entity.js @@ -29,7 +29,8 @@ Render this widget into the DOM EntityWidget.prototype.render = function(parent,nextSibling) { this.parentDomNode = parent; this.execute(); - var textNode = this.document.createTextNode($tw.utils.entityDecode(this.parseTreeNode.entity)); + var entityString = this.getAttribute("entity",this.parseTreeNode.entity || ""), + textNode = this.document.createTextNode($tw.utils.entityDecode(entityString)); parent.insertBefore(textNode,nextSibling); this.domNodes.push(textNode); }; @@ -44,7 +45,13 @@ EntityWidget.prototype.execute = function() { Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering */ EntityWidget.prototype.refresh = function(changedTiddlers) { - return false; + var changedAttributes = this.computeAttributes(); + if(changedAttributes.entity) { + this.refreshSelf(); + return true; + } else { + return false; + } }; exports.entity = EntityWidget; diff --git a/core/modules/widgets/keyboard.js b/core/modules/widgets/keyboard.js index df32cc5b8..e8c197940 100644 --- a/core/modules/widgets/keyboard.js +++ b/core/modules/widgets/keyboard.js @@ -41,7 +41,7 @@ KeyboardWidget.prototype.render = function(parent,nextSibling) { domNode.className = classes.join(" "); // Add a keyboard event handler domNode.addEventListener("keydown",function (event) { - if($tw.utils.checkKeyDescriptor(event,self.keyInfo)) { + if($tw.keyboardManager.checkKeyDescriptors(event,self.keyInfoArray)) { self.invokeActions(this,event); self.dispatchMessage(event); event.preventDefault(); @@ -68,7 +68,7 @@ KeyboardWidget.prototype.execute = function() { this.message = this.getAttribute("message"); this.param = this.getAttribute("param"); this.key = this.getAttribute("key"); - this.keyInfo = $tw.utils.parseKeyDescriptor(this.key); + this.keyInfoArray = $tw.keyboardManager.parseKeyDescriptors(this.key); this["class"] = this.getAttribute("class"); // Make child widgets this.makeChildWidgets(); diff --git a/core/modules/widgets/wikify.js b/core/modules/widgets/wikify.js new file mode 100644 index 000000000..3c99c8e5c --- /dev/null +++ b/core/modules/widgets/wikify.js @@ -0,0 +1,154 @@ +/*\ +title: $:/core/modules/widgets/wikify.js +type: application/javascript +module-type: widget + +Widget to wikify text into a variable + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var WikifyWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +WikifyWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +WikifyWidget.prototype.render = function(parent,nextSibling) { + this.parentDomNode = parent; + this.computeAttributes(); + this.execute(); + this.renderChildren(parent,nextSibling); +}; + +/* +Compute the internal state of the widget +*/ +WikifyWidget.prototype.execute = function() { + // Get our parameters + this.wikifyName = this.getAttribute("name"); + this.wikifyText = this.getAttribute("text"); + this.wikifyType = this.getAttribute("type"); + this.wikifyMode = this.getAttribute("mode","block"); + this.wikifyOutput = this.getAttribute("output","text"); + // Create the parse tree + this.wikifyParser = this.wiki.parseText(this.wikifyType,this.wikifyText,{ + parseAsInline: this.wikifyMode === "inline" + }); + // Create the widget tree + this.wikifyWidgetNode = this.wiki.makeWidget(this.wikifyParser,{ + document: $tw.fakeDocument, + parentWidget: this + }); + // Render the widget tree to the container + this.wikifyContainer = $tw.fakeDocument.createElement("div"); + this.wikifyWidgetNode.render(this.wikifyContainer,null); + this.wikifyResult = this.getResult(); + // Set context variable + this.setVariable(this.wikifyName,this.wikifyResult); + // Construct the child widgets + this.makeChildWidgets(); +}; + +/* +Return the result string +*/ +WikifyWidget.prototype.getResult = function() { + var result; + switch(this.wikifyOutput) { + case "text": + result = this.wikifyContainer.textContent; + break; + case "html": + result = this.wikifyContainer.innerHTML; + break; + case "parsetree": + result = JSON.stringify(this.wikifyParser.tree,0,$tw.config.preferences.jsonSpaces); + break; + case "widgettree": + result = JSON.stringify(this.getWidgetTree(),0,$tw.config.preferences.jsonSpaces); + break; + } + return result; +}; + +/* +Return a string of the widget tree +*/ +WikifyWidget.prototype.getWidgetTree = function() { + var copyNode = function(widgetNode,resultNode) { + var type = widgetNode.parseTreeNode.type; + resultNode.type = type; + switch(type) { + case "element": + resultNode.tag = widgetNode.parseTreeNode.tag; + break; + case "text": + resultNode.text = widgetNode.parseTreeNode.text; + break; + } + if(Object.keys(widgetNode.attributes || {}).length > 0) { + resultNode.attributes = {}; + $tw.utils.each(widgetNode.attributes,function(attr,attrName) { + resultNode.attributes[attrName] = widgetNode.getAttribute(attrName); + }); + } + if(Object.keys(widgetNode.children || {}).length > 0) { + resultNode.children = []; + $tw.utils.each(widgetNode.children,function(widgetChildNode) { + var node = {}; + resultNode.children.push(node); + copyNode(widgetChildNode,node); + }); + } + }, + results = {}; + copyNode(this.wikifyWidgetNode,results); + return results; +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering +*/ +WikifyWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + // Refresh ourselves entirely if any of our attributes have changed + if(changedAttributes.name || changedAttributes.text || changedAttributes.type || changedAttributes.mode || changedAttributes.output) { + this.refreshSelf(); + return true; + } else { + // Refresh the widget tree + if(this.wikifyWidgetNode.refresh(changedTiddlers)) { + // Check if there was any change + var result = this.getResult(); + if(result !== this.wikifyResult) { + // If so, save the change + this.wikifyResult = result; + this.setVariable(this.wikifyName,this.wikifyResult); + // Refresh each of our child widgets + $tw.utils.each(this.children,function(childWidget) { + childWidget.refreshSelf(); + }); + return true; + } + } + // Just refresh the children + return this.refreshChildren(changedTiddlers); + } +}; + +exports.wikify = WikifyWidget; + +})(); diff --git a/core/ui/ControlPanel/Basics.tid b/core/ui/ControlPanel/Basics.tid index 714954a35..52ff077c3 100644 --- a/core/ui/ControlPanel/Basics.tid +++ b/core/ui/ControlPanel/Basics.tid @@ -19,7 +19,7 @@ caption: {{$:/language/ControlPanel/Basics/Caption}} |<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> | |<$link to="$:/status/UserName"><<lingo Username/Prompt>></$link> |<$edit-text tiddler="$:/status/UserName" default="" tag="input"/> | |<$link to="$:/config/AnimationDuration"><<lingo AnimDuration/Prompt>></$link> |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> | -|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// | +|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers" class="tc-edit-texteditor"/><br>//<<lingo DefaultTiddlers/BottomHint>>// | |<$link to="$:/config/NewJournal/Title"><<lingo NewJournal/Title/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Title" default="" tag="input"/> | |<$link to="$:/config/NewJournal/Tags"><<lingo NewJournal/Tags/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Tags" default="" tag="input"/> | |<<lingo Language/Prompt>> |{{$:/snippets/minilanguageswitcher}} | diff --git a/core/ui/ControlPanel/KeyboardShortcuts.tid b/core/ui/ControlPanel/KeyboardShortcuts.tid new file mode 100644 index 000000000..64301a4ac --- /dev/null +++ b/core/ui/ControlPanel/KeyboardShortcuts.tid @@ -0,0 +1,140 @@ +title: $:/core/ui/ControlPanel/KeyboardShortcuts +tags: $:/tags/ControlPanel +caption: {{$:/language/ControlPanel/KeyboardShortcuts/Caption}} + +\define lingo-base() $:/language/ControlPanel/KeyboardShortcuts/ + +\define new-shortcut(title) +<div class="tc-dropdown-item-plain"> +<$edit-shortcut tiddler="$title$" placeholder={{$:/language/ControlPanel/KeyboardShortcuts/Add/Prompt}} style="width:auto;"/> <$button> +<<lingo Add/Caption>> +<$action-listops + $tiddler="$(shortcutTitle)$" + $field="text" + $subfilter="[{$title$}]" +/> +<$action-deletetiddler + $tiddler="$title$" +/> +</$button> +</div> +\end + +\define shortcut-list-item(caption) +<td> +</td> +<td style="text-align:right;font-size:0.7em;"> +<<lingo Platform/$caption$>> +</td> +<td> +<div style="position:relative;"> +<$button popup=<<qualify "$:/state/dropdown/$(shortcutTitle)$">> class="tc-btn-invisible"> +{{$:/core/images/edit-button}} +</$button> +<$macrocall $name="displayshortcuts" $output="text/html" shortcuts={{$(shortcutTitle)$}} prefix="<kbd>" separator="</kbd> <kbd>" suffix="</kbd>"/> + +<$reveal state=<<qualify "$:/state/dropdown/$(shortcutTitle)$">> type="popup" position="below" animate="yes"> +<div class="tc-block-dropdown-wrapper"> +<div class="tc-block-dropdown tc-edit-type-dropdown tc-popup-keep"> +<$list filter="[list[$(shortcutTitle)$!!text]sort[title]]" variable="shortcut" emptyMessage=""" +<div class="tc-dropdown-item-plain"> +//<<lingo NoShortcuts/Caption>>// +</div> +"""> +<div class="tc-dropdown-item-plain"> +<$button class="tc-btn-invisible" tooltip=<<lingo Remove/Hint>>> +<$action-listops + $tiddler="$(shortcutTitle)$" + $field="text" + $subfilter="+[remove<shortcut>]" +/> +× +</$button> +<kbd> +<$macrocall $name="displayshortcuts" $output="text/html" shortcuts=<<shortcut>>/> +</kbd> +</div> +</$list> +<hr/> +<$macrocall $name="new-shortcut" title=<<qualify "$:/state/new-shortcut/$(shortcutTitle)$">>/> +</div> +</div> +</$reveal> +</div> +</td> +\end + +\define shortcut-list(caption,prefix) +<tr> +<$list filter="[all[tiddlers+shadows][$prefix$$(shortcutName)$]]" variable="shortcutTitle"> +<<shortcut-list-item "$caption$">> +</$list> +</tr> +\end + +\define shortcut-editor() +<<shortcut-list "All" "$:/config/shortcuts/">> +<<shortcut-list "Mac" "$:/config/shortcuts-mac/">> +<<shortcut-list "NonMac" "$:/config/shortcuts-not-mac/">> +<<shortcut-list "Linux" "$:/config/shortcuts-linux/">> +<<shortcut-list "NonLinux" "$:/config/shortcuts-not-linux/">> +<<shortcut-list "Windows" "$:/config/shortcuts-windows/">> +<<shortcut-list "NonWindows" "$:/config/shortcuts-not-windows/">> +\end + +\define shortcut-preview() +<$macrocall $name="displayshortcuts" $output="text/html" shortcuts={{$(shortcutPrefix)$$(shortcutName)$}} prefix="<kbd>" separator="</kbd> <kbd>" suffix="</kbd>"/> +\end + +\define shortcut-item-inner() +<tr> +<td> +<$reveal type="nomatch" state=<<dropdownStateTitle>> text="open"> +<$button class="tc-btn-invisible"> +<$action-setfield + $tiddler=<<dropdownStateTitle>> + $value="open" +/> +{{$:/core/images/right-arrow}} +</$button> +</$reveal> +<$reveal type="match" state=<<dropdownStateTitle>> text="open"> +<$button class="tc-btn-invisible"> +<$action-setfield + $tiddler=<<dropdownStateTitle>> + $value="close" +/> +{{$:/core/images/down-arrow}} +</$button> +</$reveal> +''<$text text=<<shortcutName>>/>'' +</td> +<td> +<$transclude tiddler="$:/config/ShortcutInfo/$(shortcutName)$"/> +</td> +<td> +<$list filter="$:/config/shortcuts/ $:/config/shortcuts-mac/ $:/config/shortcuts-not-mac/ $:/config/shortcuts-linux/ $:/config/shortcuts-not-linux/ $:/config/shortcuts-windows/ $:/config/shortcuts-not-windows/" variable="shortcutPrefix"> +<<shortcut-preview>> +</$list> +</td> +</tr> +<$set name="dropdownState" value={{$(dropdownStateTitle)$}}> +<$list filter="[<dropdownState>prefix[open]]" variable="listItem"> +<<shortcut-editor>> +</$list> +</$set> +\end + +\define shortcut-item() +<$set name="dropdownStateTitle" value=<<qualify "$:/state/dropdown/keyboardshortcut/$(shortcutName)$">>> +<<shortcut-item-inner>> +</$set> +\end + +<table> +<tbody> +<$list filter="[all[shadows+tiddlers]removeprefix[$:/config/ShortcutInfo/]]" variable="shortcutName"> +<<shortcut-item>> +</$list> +</tbody> +</table> diff --git a/core/ui/ControlPanel/Toolbars/EditorToolbar.tid b/core/ui/ControlPanel/Toolbars/EditorToolbar.tid new file mode 100644 index 000000000..ce700fa98 --- /dev/null +++ b/core/ui/ControlPanel/Toolbars/EditorToolbar.tid @@ -0,0 +1,21 @@ +title: $:/core/ui/ControlPanel/Toolbars/EditorToolbar +tags: $:/tags/ControlPanel/Toolbars +caption: {{$:/language/ControlPanel/Toolbars/EditorToolbar/Caption}} + +\define lingo-base() $:/language/TiddlerInfo/ + +\define config-title() +$:/config/EditorToolbarButtons/Visibility/$(listItem)$ +\end + +\define toolbar-button() +<$checkbox tiddler=<<config-title>> field="text" checked="show" unchecked="hide" default="show"> <$transclude tiddler={{$(listItem)$!!icon}}/> <$transclude tiddler=<<listItem>> field="caption"/> -- <i class="tc-muted"><$transclude tiddler=<<listItem>> field="description"/></i></$checkbox> +\end + +{{$:/language/ControlPanel/Toolbars/EditorToolbar/Hint}} + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]" variable="listItem"> + +<<toolbar-button>> + +</$list> diff --git a/core/ui/EditTemplate.tid b/core/ui/EditTemplate.tid index 10c364681..ffea3283a 100644 --- a/core/ui/EditTemplate.tid +++ b/core/ui/EditTemplate.tid @@ -5,8 +5,8 @@ tc-tiddler-frame tc-tiddler-edit-frame $(missingTiddlerClass)$ $(shadowTiddlerCl \end <div class=<<frame-classes>>> <$set name="storyTiddler" value=<<currentTiddler>>> -<$keyboard key={{$:/config/shortcuts/cancel-edit-tiddler}} message="tm-cancel-tiddler"> -<$keyboard key={{$:/config/shortcuts/save-tiddler}} message="tm-save-tiddler"> +<$keyboard key="((cancel-edit-tiddler))" message="tm-cancel-tiddler"> +<$keyboard key="((save-tiddler))" message="tm-save-tiddler"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem"> <$transclude tiddler=<<listItem>>/> </$list> diff --git a/core/ui/EditTemplate/body-editor.tid b/core/ui/EditTemplate/body-editor.tid new file mode 100644 index 000000000..e9212c009 --- /dev/null +++ b/core/ui/EditTemplate/body-editor.tid @@ -0,0 +1,11 @@ +title: $:/core/ui/EditTemplate/body/editor + +<$edit field="text" class="tc-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}> +<$set name="targetTiddler" value=<<currentTiddler>>> +<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]]"> +<$reveal type="nomatch" state=<<config-visibility-title>> text="hide" class="tc-text-editor-toolbar-item-wrapper"> +<$transclude tiddler="$:/core/ui/EditTemplate/body/toolbar/button" mode="inline"/> +</$reveal> +</$list> +</$set> +</$edit> diff --git a/core/ui/EditTemplate/body-toolbar-button.tid b/core/ui/EditTemplate/body-toolbar-button.tid new file mode 100644 index 000000000..33d0d802d --- /dev/null +++ b/core/ui/EditTemplate/body-toolbar-button.tid @@ -0,0 +1,47 @@ +title: $:/core/ui/EditTemplate/body/toolbar/button + +\define toolbar-button-icon() +<$list filter="[all[current]!has[custom-icon]]" variable="no-custom-icon"> +<$transclude tiddler={{!!icon}}/> +</$list> +\end + +\define toolbar-button-tooltip() +{{!!description}}<$macrocall $name="displayshortcuts" $output="text/plain" shortcuts={{!!shortcuts}} prefix="` - [" separator="] [" suffix="]`"/> +\end + +\define toolbar-button() +<$list filter={{!!condition}} variable="list-condition"> +<$wikify name="tooltip-text" text=<<toolbar-button-tooltip>> mode="inline" output="text"> +<$list filter="[all[current]!has[dropdown]]" variable="no-dropdown"> +<$button class="tc-btn-invisible $(buttonClasses)$" tooltip=<<tooltip-text>>> +<span data-tw-keyboard-shortcut={{!!shortcuts}}/> +<<toolbar-button-icon>> +<$transclude tiddler=<<currentTiddler>> field="text"/> +</$button> +</$list> +<$list filter="[all[current]has[dropdown]]" variable="dropdown"> +<$set name="dropdown-state" value=<<qualify "$:/state/EditorToolbarDropdown">>> +<$button popup=<<dropdown-state>> class="tc-popup-keep tc-btn-invisible $(buttonClasses)$" selectedClass="tc-selected" tooltip=<<tooltip-text>>> +<span data-tw-keyboard-shortcut={{!!shortcuts}}/> +<<toolbar-button-icon>> +<$transclude tiddler=<<currentTiddler>> field="text"/> +</$button> +<$reveal state=<<dropdown-state>> type="popup" position="below" animate="yes" tag="span"> +<div class="tc-drop-down tc-popup-keep" style="max-width: 75%;"> +<$transclude tiddler={{!!dropdown}} mode="block"/> +</div> +</$reveal> +</$set> +</$list> +</$wikify> +</$list> +\end + +\define toolbar-button-outer() +<$set name="buttonClasses" value={{!!button-classes}}> +<<toolbar-button>> +</$set> +\end + +<<toolbar-button-outer>> diff --git a/core/ui/EditTemplate/body.tid b/core/ui/EditTemplate/body.tid index 7891171ac..f6cb3469e 100644 --- a/core/ui/EditTemplate/body.tid +++ b/core/ui/EditTemplate/body.tid @@ -2,6 +2,9 @@ title: $:/core/ui/EditTemplate/body tags: $:/tags/EditTemplate \define lingo-base() $:/language/EditTemplate/Body/ +\define config-visibility-title() +$:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$ +\end <$list filter="[is[current]has[_canonical_uri]]"> <div class="tc-message-box"> @@ -20,16 +23,10 @@ tags: $:/tags/EditTemplate <$reveal state="$:/state/showeditpreview" type="match" text="yes"> -<em class="tc-edit"><<lingo Hint>></em> <$button type="set" set="$:/state/showeditpreview" setTo="no"><<lingo Preview/Button/Hide>></$button> <$list filter="[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]butfirst[]limit[1]]" variable="listItem"> -<em class="tc-edit"><<lingo Preview/Type>></em> <$select tiddler="$:/state/editpreviewtype" default="$:/core/ui/EditTemplate/body/preview/output"> -<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]]"> -<option value=<<currentTiddler>>>{{!!caption}}</option> -</$list> -</$select> - -</$list> - <div class="tc-tiddler-preview"> + +<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/> + <div class="tc-tiddler-preview-preview"> <$transclude tiddler={{$:/state/editpreviewtype}} mode="inline"> @@ -40,19 +37,13 @@ tags: $:/tags/EditTemplate </div> -<div class="tc-tiddler-preview-edit"> -<$edit field="text" class="tc-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/> - -</div> - </div> </$reveal> <$reveal state="$:/state/showeditpreview" type="nomatch" text="yes"> -<em class="tc-edit"><<lingo Hint>></em> <$button type="set" set="$:/state/showeditpreview" setTo="yes"><<lingo Preview/Button/Show>></$button> -<$edit field="text" class="tc-edit-texteditor" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/> +<$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/> </$reveal> diff --git a/core/ui/EditorToolbar/bold.tid b/core/ui/EditorToolbar/bold.tid new file mode 100644 index 000000000..ffe84de61 --- /dev/null +++ b/core/ui/EditorToolbar/bold.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/bold +tags: $:/tags/EditorToolbar +icon: $:/core/images/bold +caption: {{$:/language/Buttons/Bold/Caption}} +description: {{$:/language/Buttons/Bold/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((bold)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="''" + suffix="''" +/> diff --git a/core/ui/EditorToolbar/clear-dropdown.tid b/core/ui/EditorToolbar/clear-dropdown.tid new file mode 100644 index 000000000..8876ecf2b --- /dev/null +++ b/core/ui/EditorToolbar/clear-dropdown.tid @@ -0,0 +1,21 @@ +title: $:/core/ui/EditorToolbar/clear-dropdown + +''{{$:/language/Buttons/Clear/Hint}}'' + +<div class="tc-colour-chooser"> + +<$macrocall $name="colour-picker" actions=""" + +<$action-sendmessage + $message="tm-edit-bitmap-operation" + $param="clear" + colour=<<colour-picker-value>> +/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +"""/> + +</div> diff --git a/core/ui/EditorToolbar/clear.tid b/core/ui/EditorToolbar/clear.tid new file mode 100644 index 000000000..876c9f51c --- /dev/null +++ b/core/ui/EditorToolbar/clear.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/clear +tags: $:/tags/EditorToolbar +icon: $:/core/images/erase +caption: {{$:/language/Buttons/Clear/Caption}} +description: {{$:/language/Buttons/Clear/Hint}} +condition: [<targetTiddler>is[image]] +dropdown: $:/core/ui/EditorToolbar/clear-dropdown + diff --git a/core/ui/EditorToolbar/editor-height-dropdown.tid b/core/ui/EditorToolbar/editor-height-dropdown.tid new file mode 100644 index 000000000..da1925b05 --- /dev/null +++ b/core/ui/EditorToolbar/editor-height-dropdown.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/editor-height-dropdown + +\define lingo-base() $:/language/Buttons/EditorHeight/ +''<<lingo Hint>>'' + +<$radio tiddler="$:/config/TextEditor/EditorHeight/Mode" value="auto"> {{$:/core/images/auto-height}} <<lingo Caption/Auto>></$radio> + +<$radio tiddler="$:/config/TextEditor/EditorHeight/Mode" value="fixed"> {{$:/core/images/fixed-height}} <<lingo Caption/Fixed>> <$edit-text tag="input" tiddler="$:/config/TextEditor/EditorHeight/Height" default="100px"/></$radio> diff --git a/core/ui/EditorToolbar/editor-height.tid b/core/ui/EditorToolbar/editor-height.tid new file mode 100644 index 000000000..c6c45775f --- /dev/null +++ b/core/ui/EditorToolbar/editor-height.tid @@ -0,0 +1,15 @@ +title: $:/core/ui/EditorToolbar/editor-height +tags: $:/tags/EditorToolbar +icon: $:/core/images/fixed-height +custom-icon: yes +caption: {{$:/language/Buttons/EditorHeight/Caption}} +description: {{$:/language/Buttons/EditorHeight/Hint}} +condition: [<targetTiddler>!is[image]] +dropdown: $:/core/ui/EditorToolbar/editor-height-dropdown + +<$reveal tag="span" state="$:/config/TextEditor/EditorHeight/Mode" type="match" text="fixed"> +{{$:/core/images/fixed-height}} +</$reveal> +<$reveal tag="span" state="$:/config/TextEditor/EditorHeight/Mode" type="match" text="auto"> +{{$:/core/images/auto-height}} +</$reveal> diff --git a/core/ui/EditorToolbar/excise-dropdown.tid b/core/ui/EditorToolbar/excise-dropdown.tid new file mode 100644 index 000000000..509133512 --- /dev/null +++ b/core/ui/EditorToolbar/excise-dropdown.tid @@ -0,0 +1,45 @@ +title: $:/core/ui/EditorToolbar/excise-dropdown + +\define lingo-base() $:/language/Buttons/Excise/ +''<<lingo Hint>>'' + +<<lingo Caption/NewTitle>> <$edit-text tag="input" tiddler="""$(config-title)$/new-title""" default="" focus="true"/> + +<$set name="new-title" value={{$(config-title)$/new-title}}> +<$list filter="""[<new-title>is[tiddler]]"""> +<div class="tc-error"> +<<lingo Caption/TiddlerExists>> +</div> +</$list> +</$set> + +<$checkbox tiddler="""$(config-title)$/tagnew""" field="text" checked="yes" unchecked="no" default="false"> <<lingo Caption/Tag>></$checkbox> + +<<lingo Caption/Replace>> <$select tiddler="""$(config-title)$/type""" default="transclude"> +<option value="link"><<lingo Caption/Replace/Link>></option> +<option value="transclude"><<lingo Caption/Replace/Transclusion>></option> +<option value="macro"><<lingo Caption/Replace/Macro>></option> +</$select> + +<$reveal state="""$(config-title)$/type""" type="match" text="macro"> +<<lingo Caption/MacroName>> <$edit-text tag="input" tiddler="""$(config-title)$/macro-title""" default="translink"/> +</$reveal> + +<$button> +<$action-sendmessage + $message="tm-edit-text-operation" + $param="excise" + title={{$(config-title)$/new-title}} + type={{$(config-title)$/type}} + macro={{$(config-title)$/macro-title}} + tagnew={{$(config-title)$/tagnew}} +/> +<$action-deletetiddler + $tiddler="""$(config-title)$/new-title""" +/> +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> +<<lingo Caption/Excise>> +</$button> + diff --git a/core/ui/EditorToolbar/excise.tid b/core/ui/EditorToolbar/excise.tid new file mode 100644 index 000000000..dc2b34d3b --- /dev/null +++ b/core/ui/EditorToolbar/excise.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/excise +tags: $:/tags/EditorToolbar +icon: $:/core/images/excise +caption: {{$:/language/Buttons/Excise/Caption}} +description: {{$:/language/Buttons/Excise/Hint}} +condition: [<targetTiddler>!is[image]] +shortcuts: ((excise)) +dropdown: $:/core/ui/EditorToolbar/excise-dropdown + diff --git a/core/ui/EditorToolbar/heading-1.tid b/core/ui/EditorToolbar/heading-1.tid new file mode 100644 index 000000000..0d244aa88 --- /dev/null +++ b/core/ui/EditorToolbar/heading-1.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-1 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-1 +caption: {{$:/language/Buttons/Heading1/Caption}} +description: {{$:/language/Buttons/Heading1/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((heading-1)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="1" +/> diff --git a/core/ui/EditorToolbar/heading-2.tid b/core/ui/EditorToolbar/heading-2.tid new file mode 100644 index 000000000..7139bf3d0 --- /dev/null +++ b/core/ui/EditorToolbar/heading-2.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-2 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-2 +caption: {{$:/language/Buttons/Heading2/Caption}} +description: {{$:/language/Buttons/Heading2/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((heading-2)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="2" +/> diff --git a/core/ui/EditorToolbar/heading-3.tid b/core/ui/EditorToolbar/heading-3.tid new file mode 100644 index 000000000..e00dd832b --- /dev/null +++ b/core/ui/EditorToolbar/heading-3.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-3 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-3 +caption: {{$:/language/Buttons/Heading3/Caption}} +description: {{$:/language/Buttons/Heading3/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((heading-3)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="3" +/> diff --git a/core/ui/EditorToolbar/heading-4.tid b/core/ui/EditorToolbar/heading-4.tid new file mode 100644 index 000000000..4a4b7a90b --- /dev/null +++ b/core/ui/EditorToolbar/heading-4.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-4 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-4 +caption: {{$:/language/Buttons/Heading4/Caption}} +description: {{$:/language/Buttons/Heading4/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((heading-4)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="4" +/> diff --git a/core/ui/EditorToolbar/heading-5.tid b/core/ui/EditorToolbar/heading-5.tid new file mode 100644 index 000000000..09f0bcf4c --- /dev/null +++ b/core/ui/EditorToolbar/heading-5.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-5 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-5 +caption: {{$:/language/Buttons/Heading5/Caption}} +description: {{$:/language/Buttons/Heading5/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((heading-5)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="5" +/> diff --git a/core/ui/EditorToolbar/heading-6.tid b/core/ui/EditorToolbar/heading-6.tid new file mode 100644 index 000000000..d5d8dc045 --- /dev/null +++ b/core/ui/EditorToolbar/heading-6.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/heading-6 +tags: $:/tags/EditorToolbar +icon: $:/core/images/heading-6 +caption: {{$:/language/Buttons/Heading6/Caption}} +description: {{$:/language/Buttons/Heading6/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((heading-6)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="!" + count="6" +/> diff --git a/core/ui/EditorToolbar/italic.tid b/core/ui/EditorToolbar/italic.tid new file mode 100644 index 000000000..518f3d0c2 --- /dev/null +++ b/core/ui/EditorToolbar/italic.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/italic +tags: $:/tags/EditorToolbar +icon: $:/core/images/italic +caption: {{$:/language/Buttons/Italic/Caption}} +description: {{$:/language/Buttons/Italic/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((italic)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="//" + suffix="//" +/> diff --git a/core/ui/EditorToolbar/line-width-dropdown.tid b/core/ui/EditorToolbar/line-width-dropdown.tid new file mode 100644 index 000000000..b99bdcde4 --- /dev/null +++ b/core/ui/EditorToolbar/line-width-dropdown.tid @@ -0,0 +1,42 @@ +title: $:/core/ui/EditorToolbar/line-width-dropdown + +\define lingo-base() $:/language/Buttons/LineWidth/ + +\define toolbar-line-width-inner() +<$button tag="a" tooltip="""$(line-width)$"""> + +<$action-setfield + $tiddler="$:/config/BitmapEditor/LineWidth" + $value="$(line-width)$" +/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +<div style="display: inline-block; margin: 4px calc(80px - $(line-width)$); background-color: #000; width: calc(100px + $(line-width)$ * 2); height: $(line-width)$; border-radius: 120px; vertical-align: middle;"/> + +<span style="margin-left: 8px;"> + +<$text text="""$(line-width)$"""/> + +<$reveal state="$:/config/BitmapEditor/LineWidth" type="match" text="""$(line-width)$""" tag="span"> + +<$entity entity=" "/> + +<$entity entity="✓"/> + +</$reveal> + +</span> + +</$button> +\end + +''<<lingo Hint>>'' + +<$list filter={{$:/config/BitmapEditor/LineWidths}} variable="line-width"> + +<<toolbar-line-width-inner>> + +</$list> diff --git a/core/ui/EditorToolbar/line-width.tid b/core/ui/EditorToolbar/line-width.tid new file mode 100644 index 000000000..3910745a3 --- /dev/null +++ b/core/ui/EditorToolbar/line-width.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/line-width +tags: $:/tags/EditorToolbar +icon: $:/core/images/line-width +caption: {{$:/language/Buttons/LineWidth/Caption}} +description: {{$:/language/Buttons/LineWidth/Hint}} +condition: [<targetTiddler>is[image]] +dropdown: $:/core/ui/EditorToolbar/line-width-dropdown + +<$text text={{$:/config/BitmapEditor/LineWidth}}/> \ No newline at end of file diff --git a/core/ui/EditorToolbar/list-bullet.tid b/core/ui/EditorToolbar/list-bullet.tid new file mode 100644 index 000000000..dfa14cc18 --- /dev/null +++ b/core/ui/EditorToolbar/list-bullet.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/list-bullet +tags: $:/tags/EditorToolbar +icon: $:/core/images/list-bullet +caption: {{$:/language/Buttons/ListBullet/Caption}} +description: {{$:/language/Buttons/ListBullet/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((list-bullet)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="*" + count="1" +/> diff --git a/core/ui/EditorToolbar/list-number.tid b/core/ui/EditorToolbar/list-number.tid new file mode 100644 index 000000000..81b9152d0 --- /dev/null +++ b/core/ui/EditorToolbar/list-number.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/list-number +tags: $:/tags/EditorToolbar +icon: $:/core/images/list-number +caption: {{$:/language/Buttons/ListNumber/Caption}} +description: {{$:/language/Buttons/ListNumber/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((list-number)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="prefix-lines" + character="#" + count="1" +/> diff --git a/core/ui/EditorToolbar/mono-block.tid b/core/ui/EditorToolbar/mono-block.tid new file mode 100644 index 000000000..977937f09 --- /dev/null +++ b/core/ui/EditorToolbar/mono-block.tid @@ -0,0 +1,15 @@ +title: $:/core/ui/EditorToolbar/mono-block +tags: $:/tags/EditorToolbar +icon: $:/core/images/mono-block +caption: {{$:/language/Buttons/MonoBlock/Caption}} +description: {{$:/language/Buttons/MonoBlock/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((mono-block)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-lines" + prefix=" +```" + suffix="```" +/> diff --git a/core/ui/EditorToolbar/mono-line.tid b/core/ui/EditorToolbar/mono-line.tid new file mode 100644 index 000000000..15ca77de1 --- /dev/null +++ b/core/ui/EditorToolbar/mono-line.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/mono-line +tags: $:/tags/EditorToolbar +icon: $:/core/images/mono-line +caption: {{$:/language/Buttons/MonoLine/Caption}} +description: {{$:/language/Buttons/MonoLine/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((mono-line)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="`" + suffix="`" +/> diff --git a/core/ui/EditorToolbar/more-dropdown.tid b/core/ui/EditorToolbar/more-dropdown.tid new file mode 100644 index 000000000..289f74011 --- /dev/null +++ b/core/ui/EditorToolbar/more-dropdown.tid @@ -0,0 +1,19 @@ +title: $:/core/ui/EditorToolbar/more-dropdown + +\define config-title() +$:/config/EditorToolbarButtons/Visibility/$(toolbarItem)$ +\end + +\define conditional-button() +<$list filter={{$(toolbarItem)$!!condition}} variable="condition"> +<$transclude tiddler="$:/core/ui/EditTemplate/body/toolbar/button" mode="inline"/> <$transclude tiddler=<<toolbarItem>> field="description"/> +</$list> +\end + +<div class="tc-text-editor-toolbar-more"> +<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditorToolbar]!has[draft.of]] -[[$:/core/ui/EditorToolbar/more]]"> +<$reveal type="match" state=<<config-visibility-title>> text="hide" tag="div"> +<<conditional-button>> +</$reveal> +</$list> +</div> diff --git a/core/ui/EditorToolbar/more.tid b/core/ui/EditorToolbar/more.tid new file mode 100644 index 000000000..8945f6def --- /dev/null +++ b/core/ui/EditorToolbar/more.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/more +tags: $:/tags/EditorToolbar +icon: $:/core/images/down-arrow +caption: {{$:/language/Buttons/More/Caption}} +description: {{$:/language/Buttons/More/Hint}} +condition: [<targetTiddler>] +dropdown: $:/core/ui/EditorToolbar/more-dropdown +text: diff --git a/core/ui/EditorToolbar/opacity-dropdown.tid b/core/ui/EditorToolbar/opacity-dropdown.tid new file mode 100644 index 000000000..80d287342 --- /dev/null +++ b/core/ui/EditorToolbar/opacity-dropdown.tid @@ -0,0 +1,54 @@ +title: $:/core/ui/EditorToolbar/opacity-dropdown + +\define lingo-base() $:/language/Buttons/Opacity/ + +\define toolbar-opacity-inner() +<$button tag="a" tooltip="""$(opacity)$"""> + +<$action-setfield + $tiddler="$:/config/BitmapEditor/Opacity" + $value="$(opacity)$" +/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +<div style="display: inline-block; vertical-align: middle; background-color: $(current-paint-colour)$; opacity: $(opacity)$; width: 1em; height: 1em; border-radius: 50%;"/> + +<span style="margin-left: 8px;"> + +<$text text="""$(opacity)$"""/> + +<$reveal state="$:/config/BitmapEditor/Opacity" type="match" text="""$(opacity)$""" tag="span"> + +<$entity entity=" "/> + +<$entity entity="✓"/> + +</$reveal> + +</span> + +</$button> +\end + +\define toolbar-opacity() +''<<lingo Hint>>'' + +<$list filter={{$:/config/BitmapEditor/Opacities}} variable="opacity"> + +<<toolbar-opacity-inner>> + +</$list> +\end + +<$set name="current-paint-colour" value={{$:/config/BitmapEditor/Colour}}> + +<$set name="current-opacity" value={{$:/config/BitmapEditor/Opacity}}> + +<<toolbar-opacity>> + +</$set> + +</$set> diff --git a/core/ui/EditorToolbar/opacity.tid b/core/ui/EditorToolbar/opacity.tid new file mode 100644 index 000000000..4b2170c06 --- /dev/null +++ b/core/ui/EditorToolbar/opacity.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/opacity +tags: $:/tags/EditorToolbar +icon: $:/core/images/opacity +caption: {{$:/language/Buttons/Opacity/Caption}} +description: {{$:/language/Buttons/Opacity/Hint}} +condition: [<targetTiddler>is[image]] +dropdown: $:/core/ui/EditorToolbar/opacity-dropdown + +<$text text={{$:/config/BitmapEditor/Opacity}}/> diff --git a/core/ui/EditorToolbar/paint-dropdown.tid b/core/ui/EditorToolbar/paint-dropdown.tid new file mode 100644 index 000000000..c2deaa757 --- /dev/null +++ b/core/ui/EditorToolbar/paint-dropdown.tid @@ -0,0 +1,16 @@ +title: $:/core/ui/EditorToolbar/paint-dropdown + +''{{$:/language/Buttons/Paint/Hint}}'' + +<$macrocall $name="colour-picker" actions=""" + +<$action-setfield + $tiddler="$:/config/BitmapEditor/Colour" + $value=<<colour-picker-value>> +/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +"""/> diff --git a/core/ui/EditorToolbar/paint.tid b/core/ui/EditorToolbar/paint.tid new file mode 100644 index 000000000..8ca488888 --- /dev/null +++ b/core/ui/EditorToolbar/paint.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/paint +tags: $:/tags/EditorToolbar +icon: $:/core/images/paint +caption: {{$:/language/Buttons/Paint/Caption}} +description: {{$:/language/Buttons/Paint/Hint}} +condition: [<targetTiddler>is[image]] +dropdown: $:/core/ui/EditorToolbar/paint-dropdown + +\define toolbar-paint() +<div style="display: inline-block; vertical-align: middle; background-color: $(colour-picker-value)$; width: 1em; height: 1em; border-radius: 50%;"/> +\end +<$set name="colour-picker-value" value={{$:/config/BitmapEditor/Colour}}> +<<toolbar-paint>> +</$set> diff --git a/core/ui/EditorToolbar/picture-dropdown.tid b/core/ui/EditorToolbar/picture-dropdown.tid new file mode 100644 index 000000000..89ba004e5 --- /dev/null +++ b/core/ui/EditorToolbar/picture-dropdown.tid @@ -0,0 +1,21 @@ +title: $:/core/ui/EditorToolbar/picture-dropdown + +\define replacement-text() +[img[$(imageTitle)$]] +\end + +''{{$:/language/Buttons/Picture/Hint}}'' + +<$macrocall $name="image-picker" actions=""" + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="replace-selection" + text=<<replacement-text>> +/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +"""/> diff --git a/core/ui/EditorToolbar/picture.tid b/core/ui/EditorToolbar/picture.tid new file mode 100644 index 000000000..cf10c0017 --- /dev/null +++ b/core/ui/EditorToolbar/picture.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/picture +tags: $:/tags/EditorToolbar +icon: $:/core/images/picture +caption: {{$:/language/Buttons/Picture/Caption}} +description: {{$:/language/Buttons/Picture/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((picture)) +dropdown: $:/core/ui/EditorToolbar/picture-dropdown + diff --git a/core/ui/EditorToolbar/preview-type-dropdown.tid b/core/ui/EditorToolbar/preview-type-dropdown.tid new file mode 100644 index 000000000..0098aa034 --- /dev/null +++ b/core/ui/EditorToolbar/preview-type-dropdown.tid @@ -0,0 +1,33 @@ +title: $:/core/ui/EditorToolbar/preview-type-dropdown + +\define preview-type-button() +<$button tag="a"> + +<$action-setfield $tiddler="$:/state/editpreviewtype" $value="$(previewType)$"/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +<$transclude tiddler=<<previewType>> field="caption" mode="inline"> + +<$view tiddler=<<previewType>> field="title" mode="inline"/> + +</$transclude> + +<$reveal tag="span" state="$:/state/editpreviewtype" type="match" text=<<previewType>> default="$:/core/ui/EditTemplate/body/preview/output"> + +<$entity entity=" "/> + +<$entity entity="✓"/> + +</$reveal> + +</$button> +\end + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]]" variable="previewType"> + +<<preview-type-button>> + +</$list> diff --git a/core/ui/EditorToolbar/preview-type.tid b/core/ui/EditorToolbar/preview-type.tid new file mode 100644 index 000000000..5e7d315ce --- /dev/null +++ b/core/ui/EditorToolbar/preview-type.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/preview-type +tags: $:/tags/EditorToolbar +icon: $:/core/images/chevron-down +caption: {{$:/language/Buttons/PreviewType/Caption}} +description: {{$:/language/Buttons/PreviewType/Hint}} +condition: [all[shadows+tiddlers]tag[$:/tags/EditPreview]!has[draft.of]butfirst[]limit[1]] +button-classes: tc-text-editor-toolbar-item-adjunct +dropdown: $:/core/ui/EditorToolbar/preview-type-dropdown diff --git a/core/ui/EditorToolbar/preview.tid b/core/ui/EditorToolbar/preview.tid new file mode 100644 index 000000000..e8a7547be --- /dev/null +++ b/core/ui/EditorToolbar/preview.tid @@ -0,0 +1,17 @@ +title: $:/core/ui/EditorToolbar/preview +tags: $:/tags/EditorToolbar +icon: $:/core/images/preview-open +custom-icon: yes +caption: {{$:/language/Buttons/Preview/Caption}} +description: {{$:/language/Buttons/Preview/Hint}} +condition: [<targetTiddler>] +shortcuts: ((preview)) + +<$reveal state="$:/state/showeditpreview" type="match" text="yes" tag="span"> +{{$:/core/images/preview-open}} +<$action-setfield $tiddler="$:/state/showeditpreview" $value="no"/> +</$reveal> +<$reveal state="$:/state/showeditpreview" type="nomatch" text="yes" tag="span"> +{{$:/core/images/preview-closed}} +<$action-setfield $tiddler="$:/state/showeditpreview" $value="yes"/> +</$reveal> diff --git a/core/ui/EditorToolbar/quote.tid b/core/ui/EditorToolbar/quote.tid new file mode 100644 index 000000000..1fe5fd9e1 --- /dev/null +++ b/core/ui/EditorToolbar/quote.tid @@ -0,0 +1,15 @@ +title: $:/core/ui/EditorToolbar/quote +tags: $:/tags/EditorToolbar +icon: $:/core/images/quote +caption: {{$:/language/Buttons/Quote/Caption}} +description: {{$:/language/Buttons/Quote/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((quote)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-lines" + prefix=" +<<<" + suffix="<<<" +/> diff --git a/core/ui/EditorToolbar/redo.tid b/core/ui/EditorToolbar/redo.tid new file mode 100644 index 000000000..4fc6dc6cc --- /dev/null +++ b/core/ui/EditorToolbar/redo.tid @@ -0,0 +1,11 @@ +title: $:/core/ui/EditorToolbar/redo +tags: $:/tags/EditorToolbar +icon: $:/core/images/redo +caption: {{$:/language/Buttons/Redo/Caption}} +description: {{$:/language/Buttons/Redo/Hint}} +condition: [<targetTiddler>!is[image]] + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="redo" +/> diff --git a/core/ui/EditorToolbar/size-dropdown.tid b/core/ui/EditorToolbar/size-dropdown.tid new file mode 100644 index 000000000..473eb5bc2 --- /dev/null +++ b/core/ui/EditorToolbar/size-dropdown.tid @@ -0,0 +1,75 @@ +title: $:/core/ui/EditorToolbar/size-dropdown + +\define lingo-base() $:/language/Buttons/Size/ +\define toolbar-button-size-preset() +<$set name="width" filter="$(sizePair)$ +[first[]]"> + +<$set name="height" filter="$(sizePair)$ +[last[]]"> + +<$button tag="a"> + +<$action-setfield + $tiddler="""$(config-title)$/new-width""" + $value=<<width>> +/> + +<$action-setfield + $tiddler="""$(config-title)$/new-height""" + $value=<<height>> +/> + +<$action-deletetiddler + $tiddler="""$(config-title)$/presets-popup""" +/> + +<$text text=<<width>>/> × <$text text=<<height>>/> + +</$button> + +</$set> + +</$set> +\end + +\define toolbar-button-size() +''{{$:/language/Buttons/Size/Hint}}'' + +<<lingo Caption/Width>> <$edit-text tag="input" tiddler="""$(config-title)$/new-width""" default=<<tv-bitmap-editor-width>> focus="true" size="8"/> <<lingo Caption/Height>> <$edit-text tag="input" tiddler="""$(config-title)$/new-height""" default=<<tv-bitmap-editor-height>> size="8"/> <$button popup="""$(config-title)$/presets-popup""" class="tc-btn-invisible tc-popup-keep" style="width: auto; display: inline-block; background-colour: inherit;" selectedClass="tc-selected"> +{{$:/core/images/down-arrow}} +</$button> + +<$reveal tag="span" state="""$(config-title)$/presets-popup""" type="popup" position="belowleft" animate="yes"> + +<div class="tc-drop-down tc-popup-keep"> + +<$list filter={{$:/config/BitmapEditor/ImageSizes}} variable="sizePair"> + +<<toolbar-button-size-preset>> + +</$list> + +</div> + +</$reveal> + +<$button> +<$action-sendmessage + $message="tm-edit-bitmap-operation" + $param="resize" + width={{$(config-title)$/new-width}} + height={{$(config-title)$/new-height}} +/> +<$action-deletetiddler + $tiddler="""$(config-title)$/new-width""" +/> +<$action-deletetiddler + $tiddler="""$(config-title)$/new-height""" +/> +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> +<<lingo Caption/Resize>> +</$button> +\end + +<<toolbar-button-size>> diff --git a/core/ui/EditorToolbar/size.tid b/core/ui/EditorToolbar/size.tid new file mode 100644 index 000000000..ca9d31331 --- /dev/null +++ b/core/ui/EditorToolbar/size.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/EditorToolbar/size +tags: $:/tags/EditorToolbar +icon: $:/core/images/size +caption: {{$:/language/Buttons/Size/Caption}} +description: {{$:/language/Buttons/Size/Hint}} +condition: [<targetTiddler>is[image]] +dropdown: $:/core/ui/EditorToolbar/size-dropdown + diff --git a/core/ui/EditorToolbar/stamp-dropdown.tid b/core/ui/EditorToolbar/stamp-dropdown.tid new file mode 100644 index 000000000..0c6ed2052 --- /dev/null +++ b/core/ui/EditorToolbar/stamp-dropdown.tid @@ -0,0 +1,53 @@ +title: $:/core/ui/EditorToolbar/stamp-dropdown + +\define toolbar-button-stamp-inner() +<$button tag="a"> + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="replace-selection" + text={{$(snippetTitle)$}} + mode={{$(snippetTitle!!mode)$}} +/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +<$view tiddler=<<snippetTitle>> field="caption" mode="inline"> + +<$view tiddler=<<snippetTitle>> field="title" mode="inline"/> + +</$view> + +</$button> +\end + +<$list filter="[all[shadows+tiddlers]tag[$:/tags/TextEditor/Snippet]!has[draft.of]sort[caption]]" variable="snippetTitle"> + +<<toolbar-button-stamp-inner>> + +</$list> + +---- + +<$button tag="a"> + +<$action-sendmessage + $message="tm-new-tiddler" + tags="$:/tags/TextEditor/Snippet" + caption={{$:/language/Buttons/Stamp/New/Title}} + text={{$:/language/Buttons/Stamp/New/Text}} +/> + +<$action-deletetiddler + $tiddler=<<dropdown-state>> +/> + +<em> + +<$text text={{$:/language/Buttons/Stamp/Caption/New}}/> + +</em> + +</$button> diff --git a/core/ui/EditorToolbar/stamp.tid b/core/ui/EditorToolbar/stamp.tid new file mode 100644 index 000000000..bd83a2928 --- /dev/null +++ b/core/ui/EditorToolbar/stamp.tid @@ -0,0 +1,9 @@ +title: $:/core/ui/EditorToolbar/stamp +tags: $:/tags/EditorToolbar +icon: $:/core/images/stamp +caption: {{$:/language/Buttons/Stamp/Caption}} +description: {{$:/language/Buttons/Stamp/Hint}} +condition: [<targetTiddler>!is[image]] +shortcuts: ((stamp)) +dropdown: $:/core/ui/EditorToolbar/stamp-dropdown +text: diff --git a/core/ui/EditorToolbar/strikethrough.tid b/core/ui/EditorToolbar/strikethrough.tid new file mode 100644 index 000000000..53808cac3 --- /dev/null +++ b/core/ui/EditorToolbar/strikethrough.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/strikethrough +tags: $:/tags/EditorToolbar +icon: $:/core/images/strikethrough +caption: {{$:/language/Buttons/Strikethrough/Caption}} +description: {{$:/language/Buttons/Strikethrough/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((strikethrough)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="~~" + suffix="~~" +/> diff --git a/core/ui/EditorToolbar/subscript.tid b/core/ui/EditorToolbar/subscript.tid new file mode 100644 index 000000000..e2c83abbd --- /dev/null +++ b/core/ui/EditorToolbar/subscript.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/subscript +tags: $:/tags/EditorToolbar +icon: $:/core/images/subscript +caption: {{$:/language/Buttons/Subscript/Caption}} +description: {{$:/language/Buttons/Subscript/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((subscript)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix=",," + suffix=",," +/> diff --git a/core/ui/EditorToolbar/superscript.tid b/core/ui/EditorToolbar/superscript.tid new file mode 100644 index 000000000..c1a40efea --- /dev/null +++ b/core/ui/EditorToolbar/superscript.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/superscript +tags: $:/tags/EditorToolbar +icon: $:/core/images/superscript +caption: {{$:/language/Buttons/Superscript/Caption}} +description: {{$:/language/Buttons/Superscript/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((superscript)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="^^" + suffix="^^" +/> diff --git a/core/ui/EditorToolbar/underline.tid b/core/ui/EditorToolbar/underline.tid new file mode 100644 index 000000000..ec6d63319 --- /dev/null +++ b/core/ui/EditorToolbar/underline.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/EditorToolbar/underline +tags: $:/tags/EditorToolbar +icon: $:/core/images/underline +caption: {{$:/language/Buttons/Underline/Caption}} +description: {{$:/language/Buttons/Underline/Hint}} +condition: [<targetTiddler>!has[type]] [<targetTiddler>type[text/vnd.tiddlywiki]] +shortcuts: ((underline)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="__" + suffix="__" +/> diff --git a/core/ui/EditorToolbar/undo.tid b/core/ui/EditorToolbar/undo.tid new file mode 100644 index 000000000..4c4706159 --- /dev/null +++ b/core/ui/EditorToolbar/undo.tid @@ -0,0 +1,11 @@ +title: $:/core/ui/EditorToolbar/undo +tags: $:/tags/EditorToolbar +icon: $:/core/images/undo +caption: {{$:/language/Buttons/Undo/Caption}} +description: {{$:/language/Buttons/Undo/Hint}} +condition: [<targetTiddler>!is[image]] + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="undo" +/> diff --git a/core/ui/PageControls/new-image.tid b/core/ui/PageControls/new-image.tid new file mode 100644 index 000000000..bb9d4cd9c --- /dev/null +++ b/core/ui/PageControls/new-image.tid @@ -0,0 +1,14 @@ +title: $:/core/ui/Buttons/new-image +tags: $:/tags/PageControls +caption: {{$:/core/images/new-image-button}} {{$:/language/Buttons/NewImage/Caption}} +description: {{$:/language/Buttons/NewImage/Hint}} + +<$button tooltip={{$:/language/Buttons/NewImage/Hint}} aria-label={{$:/language/Buttons/NewImage/Caption}} class=<<tv-config-toolbar-class>>> +<$action-sendmessage $message="tm-new-tiddler" type="image/jpeg"/> +<$list filter="[<tv-config-toolbar-icons>prefix[yes]]"> +{{$:/core/images/new-image-button}} +</$list> +<$list filter="[<tv-config-toolbar-text>prefix[yes]]"> +<span class="tc-btn-text"><$text text={{$:/language/Buttons/NewImage/Caption}}/></span> +</$list> +</$button> diff --git a/core/wiki/config/BitmapEditorColour.tid b/core/wiki/config/BitmapEditorColour.tid index 7c3902acb..de99f92fc 100644 --- a/core/wiki/config/BitmapEditorColour.tid +++ b/core/wiki/config/BitmapEditorColour.tid @@ -1,3 +1,3 @@ title: $:/config/BitmapEditor/Colour -#ff0 \ No newline at end of file +#444 \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorImageSizes.tid b/core/wiki/config/BitmapEditorImageSizes.tid new file mode 100644 index 000000000..28de18611 --- /dev/null +++ b/core/wiki/config/BitmapEditorImageSizes.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/ImageSizes + +[[62px 100px]] [[100px 62px]] [[124px 200px]] [[200px 124px]] [[248px 400px]] [[371px 600px]] [[400px 248px]] [[556px 900px]] [[600px 371px]] [[742px 1200px]] [[900px 556px]] [[1200px 742px]] \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorLineWidth.tid b/core/wiki/config/BitmapEditorLineWidth.tid index ba51e732c..bfd979d5f 100644 --- a/core/wiki/config/BitmapEditorLineWidth.tid +++ b/core/wiki/config/BitmapEditorLineWidth.tid @@ -1,3 +1,3 @@ title: $:/config/BitmapEditor/LineWidth -3 \ No newline at end of file +3px \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorLineWidths.tid b/core/wiki/config/BitmapEditorLineWidths.tid new file mode 100644 index 000000000..b44e933cd --- /dev/null +++ b/core/wiki/config/BitmapEditorLineWidths.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/LineWidths + +0.25px 0.5px 1px 2px 3px 4px 6px 8px 10px 16px 20px 28px 40px 56px 80px \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorOpacities.tid b/core/wiki/config/BitmapEditorOpacities.tid new file mode 100644 index 000000000..a9b7e251e --- /dev/null +++ b/core/wiki/config/BitmapEditorOpacities.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/Opacities + +0.01 0.025 0.05 0.075 0.1 0.15 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 \ No newline at end of file diff --git a/core/wiki/config/BitmapEditorOpacity.tid b/core/wiki/config/BitmapEditorOpacity.tid new file mode 100644 index 000000000..9abdc4c5f --- /dev/null +++ b/core/wiki/config/BitmapEditorOpacity.tid @@ -0,0 +1,3 @@ +title: $:/config/BitmapEditor/Opacity + +1.0 \ No newline at end of file diff --git a/core/wiki/config/EditorToolbarButtons.multids b/core/wiki/config/EditorToolbarButtons.multids new file mode 100644 index 000000000..a80583d7d --- /dev/null +++ b/core/wiki/config/EditorToolbarButtons.multids @@ -0,0 +1,5 @@ +title: $:/config/EditorToolbarButtons/Visibility/$:/ + +core/ui/EditorToolbar/heading-4: hide +core/ui/EditorToolbar/heading-5: hide +core/ui/EditorToolbar/heading-6: hide diff --git a/core/wiki/config/PageControlButtons.multids b/core/wiki/config/PageControlButtons.multids index 393898551..eb54546ed 100644 --- a/core/wiki/config/PageControlButtons.multids +++ b/core/wiki/config/PageControlButtons.multids @@ -13,6 +13,7 @@ core/ui/Buttons/language: hide core/ui/Buttons/tag-manager: hide core/ui/Buttons/more-page-actions: hide core/ui/Buttons/new-journal: hide +core/ui/Buttons/new-image: hide core/ui/Buttons/palette: hide core/ui/Buttons/permaview: hide core/ui/Buttons/storyview: hide diff --git a/core/wiki/config/ShortcutInfo.multids b/core/wiki/config/ShortcutInfo.multids new file mode 100644 index 000000000..d32ff82b6 --- /dev/null +++ b/core/wiki/config/ShortcutInfo.multids @@ -0,0 +1,25 @@ +title: $:/config/ShortcutInfo/ + +bold: {{$:/language/Buttons/Bold/Hint}} +cancel-edit-tiddler: {{$:/language/Buttons/Cancel/Hint}} +excise: {{$:/language/Buttons/Excise/Hint}} +heading-1: {{$:/language/Buttons/Heading1/Hint}} +heading-2: {{$:/language/Buttons/Heading2/Hint}} +heading-3: {{$:/language/Buttons/Heading3/Hint}} +heading-4: {{$:/language/Buttons/Heading4/Hint}} +heading-5: {{$:/language/Buttons/Heading5/Hint}} +heading-6: {{$:/language/Buttons/Heading6/Hint}} +italic: {{$:/language/Buttons/Italic/Hint}} +list-bullet: {{$:/language/Buttons/ListBullet/Hint}} +list-number: {{$:/language/Buttons/ListNumber/Hint}} +mono-block: {{$:/language/Buttons/MonoBlock/Hint}} +mono-line: {{$:/language/Buttons/MonoLine/Hint}} +picture: {{$:/language/Buttons/Picture/Hint}} +preview: {{$:/language/Buttons/Preview/Hint}} +quote: {{$:/language/Buttons/Quote/Hint}} +save-tiddler: {{$:/language/Buttons/Save/Hint}} +stamp: {{$:/language/Buttons/Stamp/Hint}} +strikethrough: {{$:/language/Buttons/Strikethrough/Hint}} +subscript: {{$:/language/Buttons/Subscript/Hint}} +superscript: {{$:/language/Buttons/Superscript/Hint}} +underline: {{$:/language/Buttons/Underline/Hint}} diff --git a/core/wiki/config/TextEditorEditorHeightHeight.tid b/core/wiki/config/TextEditorEditorHeightHeight.tid new file mode 100644 index 000000000..208b2b3a7 --- /dev/null +++ b/core/wiki/config/TextEditorEditorHeightHeight.tid @@ -0,0 +1,3 @@ +title: $:/config/TextEditor/EditorHeight/Height + +400px \ No newline at end of file diff --git a/core/wiki/config/TextEditorEditorHeightMode.tid b/core/wiki/config/TextEditorEditorHeightMode.tid new file mode 100644 index 000000000..09449ffa2 --- /dev/null +++ b/core/wiki/config/TextEditorEditorHeightMode.tid @@ -0,0 +1,3 @@ +title: $:/config/TextEditor/EditorHeight/Mode + +auto \ No newline at end of file diff --git a/core/wiki/config/shortcuts/cancel-edit-tiddler.tid b/core/wiki/config/shortcuts/cancel-edit-tiddler.tid deleted file mode 100644 index dbb09ad0f..000000000 --- a/core/wiki/config/shortcuts/cancel-edit-tiddler.tid +++ /dev/null @@ -1,3 +0,0 @@ -title: $:/config/shortcuts/cancel-edit-tiddler - -escape \ No newline at end of file diff --git a/core/wiki/config/shortcuts/save-tiddler.tid b/core/wiki/config/shortcuts/save-tiddler.tid deleted file mode 100644 index da80be94c..000000000 --- a/core/wiki/config/shortcuts/save-tiddler.tid +++ /dev/null @@ -1,3 +0,0 @@ -title: $:/config/shortcuts/save-tiddler - -ctrl+enter \ No newline at end of file diff --git a/core/wiki/config/shortcuts/shortcuts-linux.multids b/core/wiki/config/shortcuts/shortcuts-linux.multids new file mode 100644 index 000000000..4fb8cb5fc --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-linux.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-linux/ + diff --git a/core/wiki/config/shortcuts/shortcuts-mac.multids b/core/wiki/config/shortcuts/shortcuts-mac.multids new file mode 100644 index 000000000..adf3f8bd2 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-mac.multids @@ -0,0 +1,5 @@ +title: $:/config/shortcuts-mac/ + +bold: meta-B +italic: meta-I +underline: meta-U diff --git a/core/wiki/config/shortcuts/shortcuts-not-linux.multids b/core/wiki/config/shortcuts/shortcuts-not-linux.multids new file mode 100644 index 000000000..e0a175ec4 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-not-linux.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-not-linux/ + diff --git a/core/wiki/config/shortcuts/shortcuts-not-mac.multids b/core/wiki/config/shortcuts/shortcuts-not-mac.multids new file mode 100644 index 000000000..3d7e3a2d8 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-not-mac.multids @@ -0,0 +1,5 @@ +title: $:/config/shortcuts-not-mac/ + +bold: ctrl-B +italic: ctrl-I +underline: ctrl-U diff --git a/core/wiki/config/shortcuts/shortcuts-not-windows.multids b/core/wiki/config/shortcuts/shortcuts-not-windows.multids new file mode 100644 index 000000000..5a80888c5 --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-not-windows.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-not-windows/ + diff --git a/core/wiki/config/shortcuts/shortcuts-windows.multids b/core/wiki/config/shortcuts/shortcuts-windows.multids new file mode 100644 index 000000000..45f0db02b --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts-windows.multids @@ -0,0 +1,2 @@ +title: $:/config/shortcuts-windows/ + diff --git a/core/wiki/config/shortcuts/shortcuts.multids b/core/wiki/config/shortcuts/shortcuts.multids new file mode 100644 index 000000000..f5838c69c --- /dev/null +++ b/core/wiki/config/shortcuts/shortcuts.multids @@ -0,0 +1,22 @@ +title: $:/config/shortcuts/ + +cancel-edit-tiddler: escape +excise: ctrl-E +heading-1: ctrl-1 +heading-2: ctrl-2 +heading-3: ctrl-3 +heading-4: ctrl-4 +heading-5: ctrl-5 +heading-6: ctrl-6 +list-bullet: ctrl-L +list-number: ctrl-N +mono-block: ctrl-shift-M +mono-line: ctrl-M +picture: ctrl-shift-I +preview: ctrl-P +quote: ctrl-Q +save-tiddler: ctrl+enter +stamp: ctrl-S +strikethrough: ctrl-T +subscript: ctrl-shift-B +superscript: ctrl-shift-P diff --git a/core/wiki/macros/colour-picker.tid b/core/wiki/macros/colour-picker.tid new file mode 100644 index 000000000..af74577e3 --- /dev/null +++ b/core/wiki/macros/colour-picker.tid @@ -0,0 +1,55 @@ +title: $:/core/macros/colour-picker +tags: $:/tags/Macro + +\define colour-picker-update-recent() +<$action-listops + $tiddler="$:/config/ColourPicker/Recent" + $subfilter="$(colour-picker-value)$ [list[$:/config/ColourPicker/Recent]remove[$(colour-picker-value)$]] +[limit[8]]" +/> +\end + +\define colour-picker-inner(actions) +<$button tag="a" tooltip="""$(colour-picker-value)$"""> + +$(colour-picker-update-recent)$ + +$actions$ + +<div style="background-color: $(colour-picker-value)$; width: 100%; height: 100%; border-radius: 50%;"/> + +</$button> +\end + +\define colour-picker-recent-inner(actions) +<$set name="colour-picker-value" value="$(recentColour)$"> +<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> +</$set> +\end + +\define colour-picker-recent(actions) +{{$:/language/ColourPicker/Recent}} <$list filter="[list[$:/config/ColourPicker/Recent]]" variable="recentColour"> +<$macrocall $name="colour-picker-recent-inner" actions="""$actions$"""/></$list> +\end + +\define colour-picker(actions) +<div class="tc-colour-chooser"> + +<$macrocall $name="colour-picker-recent" actions="""$actions$"""/> + +--- + +<$list filter="LightPink Pink Crimson LavenderBlush PaleVioletRed HotPink DeepPink MediumVioletRed Orchid Thistle Plum Violet Magenta Fuchsia DarkMagenta Purple MediumOrchid DarkViolet DarkOrchid Indigo BlueViolet MediumPurple MediumSlateBlue SlateBlue DarkSlateBlue Lavender GhostWhite Blue MediumBlue MidnightBlue DarkBlue Navy RoyalBlue CornflowerBlue LightSteelBlue LightSlateGrey SlateGrey DodgerBlue AliceBlue SteelBlue LightSkyBlue SkyBlue DeepSkyBlue LightBlue PowderBlue CadetBlue Azure LightCyan PaleTurquoise Cyan Aqua DarkTurquoise DarkSlateGrey DarkCyan Teal MediumTurquoise LightSeaGreen Turquoise Aquamarine MediumAquamarine MediumSpringGreen MintCream SpringGreen MediumSeaGreen SeaGreen Honeydew LightGreen PaleGreen DarkSeaGreen LimeGreen Lime ForestGreen Green DarkGreen Chartreuse LawnGreen GreenYellow DarkOliveGreen YellowGreen OliveDrab Beige LightGoldenrodYellow Ivory LightYellow Yellow Olive DarkKhaki LemonChiffon PaleGoldenrod Khaki Gold Cornsilk Goldenrod DarkGoldenrod FloralWhite OldLace Wheat Moccasin Orange PapayaWhip BlanchedAlmond NavajoWhite AntiqueWhite Tan BurlyWood Bisque DarkOrange Linen Peru PeachPuff SandyBrown Chocolate SaddleBrown Seashell Sienna LightSalmon Coral OrangeRed DarkSalmon Tomato MistyRose Salmon Snow LightCoral RosyBrown IndianRed Red Brown FireBrick DarkRed Maroon White WhiteSmoke Gainsboro LightGrey Silver DarkGrey Grey DimGrey Black" variable="colour-picker-value"> +<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> +</$list> + +--- + +<$edit-text tiddler="$:/config/ColourPicker/New" tag="input" default="" placeholder=""/> +<$edit-text tiddler="$:/config/ColourPicker/New" type="color" tag="input"/> +<$set name="colour-picker-value" value={{$:/config/ColourPicker/New}}> +<$macrocall $name="colour-picker-inner" actions="""$actions$"""/> +</$set> + +</div> + +\end diff --git a/core/wiki/macros/image-picker.tid b/core/wiki/macros/image-picker.tid new file mode 100644 index 000000000..9b1fcfa87 --- /dev/null +++ b/core/wiki/macros/image-picker.tid @@ -0,0 +1,26 @@ +title: $:/core/macros/image-picker +tags: $:/tags/Macro + +\define image-picker-inner(actions) +<$button tag="a" tooltip="""$(imageTitle)$"""> + +$actions$ + +<$transclude tiddler=<<imageTitle>>/> + +</$button> +\end + +\define image-picker(actions) +<div class="tc-image-chooser"> + +<$list filter="[all[shadows+tiddlers]is[image]!has[draft.of]] -[type[application/pdf]] +[sort[title]]" variable="imageTitle"> + +<$macrocall $name="image-picker-inner" actions="""$actions$"""/> + +</$list> + +</div> + +\end + diff --git a/core/wiki/macros/translink.tid b/core/wiki/macros/translink.tid new file mode 100644 index 000000000..4c5018673 --- /dev/null +++ b/core/wiki/macros/translink.tid @@ -0,0 +1,15 @@ +title: $:/core/macros/translink +tags: $:/tags/Macro + +\define translink(title,mode:"block") +<div style="border:1px solid #ccc; padding: 0.5em; background: black; foreground; white;"> +<$link to="""$title$"""> +<$text text="""$title$"""/> +</$link> +<div style="border:1px solid #ccc; padding: 0.5em; background: white; foreground; black;"> +<$transclude tiddler="""$title$""" mode="$mode$"> +"<$text text="""$title$"""/>" is missing +</$transclude> +</div> +</div> +\end diff --git a/core/wiki/tags/EditorToolbar.tid b/core/wiki/tags/EditorToolbar.tid new file mode 100644 index 000000000..8c70b7cb1 --- /dev/null +++ b/core/wiki/tags/EditorToolbar.tid @@ -0,0 +1,2 @@ +title: $:/tags/EditorToolbar +list: $:/core/ui/EditorToolbar/paint $:/core/ui/EditorToolbar/opacity $:/core/ui/EditorToolbar/line-width $:/core/ui/EditorToolbar/clear $:/core/ui/EditorToolbar/bold $:/core/ui/EditorToolbar/italic $:/core/ui/EditorToolbar/strikethrough $:/core/ui/EditorToolbar/underline $:/core/ui/EditorToolbar/superscript $:/core/ui/EditorToolbar/subscript $:/core/ui/EditorToolbar/mono-line $:/core/ui/EditorToolbar/mono-block $:/core/ui/EditorToolbar/quote $:/core/ui/EditorToolbar/list-bullet $:/core/ui/EditorToolbar/list-number $:/core/ui/EditorToolbar/heading-1 $:/core/ui/EditorToolbar/heading-2 $:/core/ui/EditorToolbar/heading-3 $:/core/ui/EditorToolbar/heading-4 $:/core/ui/EditorToolbar/heading-5 $:/core/ui/EditorToolbar/heading-6 $:/core/ui/EditorToolbar/excise $:/core/ui/EditorToolbar/picture $:/core/ui/EditorToolbar/stamp $:/core/ui/EditorToolbar/undo $:/core/ui/EditorToolbar/redo $:/core/ui/EditorToolbar/size $:/core/ui/EditorToolbar/editor-height $:/core/ui/EditorToolbar/more $:/core/ui/EditorToolbar/preview $:/core/ui/EditorToolbar/preview-type diff --git a/core/wiki/tags/PageControls.tid b/core/wiki/tags/PageControls.tid index 9ed29e911..3bef09b7d 100644 --- a/core/wiki/tags/PageControls.tid +++ b/core/wiki/tags/PageControls.tid @@ -1,2 +1,2 @@ title: $:/tags/PageControls -list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]] +list: [[$:/core/ui/Buttons/home]] [[$:/core/ui/Buttons/close-all]] [[$:/core/ui/Buttons/fold-all]] [[$:/core/ui/Buttons/unfold-all]] [[$:/core/ui/Buttons/permaview]] [[$:/core/ui/Buttons/new-tiddler]] [[$:/core/ui/Buttons/new-journal]] [[$:/core/ui/Buttons/new-image]] [[$:/core/ui/Buttons/import]] [[$:/core/ui/Buttons/export-page]] [[$:/core/ui/Buttons/control-panel]] [[$:/core/ui/Buttons/advanced-search]] [[$:/core/ui/Buttons/tag-manager]] [[$:/core/ui/Buttons/language]] [[$:/core/ui/Buttons/palette]] [[$:/core/ui/Buttons/theme]] [[$:/core/ui/Buttons/storyview]] [[$:/core/ui/Buttons/encryption]] [[$:/core/ui/Buttons/full-screen]] [[$:/core/ui/Buttons/save-wiki]] [[$:/core/ui/Buttons/refresh]] [[$:/core/ui/Buttons/more-page-actions]] diff --git a/editions/prerelease/tiddlywiki.info b/editions/prerelease/tiddlywiki.info index 43d90dcb9..24d091cc2 100644 --- a/editions/prerelease/tiddlywiki.info +++ b/editions/prerelease/tiddlywiki.info @@ -9,7 +9,8 @@ "tiddlywiki/stacked-view", "tiddlywiki/powered-by-tiddlywiki", "tiddlywiki/internals", - "tiddlywiki/highlight" + "tiddlywiki/highlight", + "tiddlywiki/markdown" ], "themes": [ "tiddlywiki/vanilla", diff --git a/editions/translators/tiddlywiki.info b/editions/translators/tiddlywiki.info index 8e4dc295a..72f4ab363 100644 --- a/editions/translators/tiddlywiki.info +++ b/editions/translators/tiddlywiki.info @@ -56,6 +56,7 @@ "--rendertiddler","$:/plugins/tiddlywiki/translators/templates/ModuleTypes.multids","language/Docs/ModuleTypes.multids","text/plain", "--rendertiddler","$:/plugins/tiddlywiki/translators/templates/PaletteColours.multids","language/Docs/PaletteColours.multids","text/plain", "--rendertiddlers","[prefix[$:/language/Help/]removeprefix[$:/language/Help/]]","$:/plugins/tiddlywiki/translators/templates/help-tid","language/Help","text/plain",".tid", + "--rendertiddlers","[prefix[$:/language/Snippets/]removeprefix[$:/language/Snippets/]]","$:/plugins/tiddlywiki/translators/templates/snippet-tid","language/Snippets","text/plain",".tid", "--rendertiddlers","[prefix[$:/language/Modals/]removeprefix[$:/language/Modals/]]","$:/plugins/tiddlywiki/translators/templates/modal-tid","language/Modals","text/plain",".tid", "--rendertiddlers","[prefix[$:/language/Docs/Types/]removeprefix[$:/language/Docs/Types/]]","$:/plugins/tiddlywiki/translators/templates/type-tid","language/Types","text/plain",".tid"] } diff --git a/editions/tw5.com/tiddlers/hiddensettings/Hidden_Setting__Keyboard_Shortcuts.tid b/editions/tw5.com/tiddlers/hiddensettings/Hidden_Setting__Keyboard_Shortcuts.tid deleted file mode 100644 index c2e8c7c02..000000000 --- a/editions/tw5.com/tiddlers/hiddensettings/Hidden_Setting__Keyboard_Shortcuts.tid +++ /dev/null @@ -1,11 +0,0 @@ -created: 20150808123932042 -modified: 20150808124201286 -tags: [[Hidden Settings]] -title: Hidden Setting: Keyboard Shortcuts -type: text/vnd.tiddlywiki - -Until a proper user interface is built, KeyboardShortcuts can only be altered via hidden settings: - -$:/config/shortcuts/cancel-edit-tiddler - keyboard shortcut for cancelling editing - -$:/config/shortcuts/save-tiddler - keyboard shortcut for confirming editing a tiddler diff --git a/editions/tw5.com/tiddlers/howtos/KeyboardShortcuts.tid b/editions/tw5.com/tiddlers/howtos/KeyboardShortcuts.tid index e5adee200..3a3b1f945 100644 --- a/editions/tw5.com/tiddlers/howtos/KeyboardShortcuts.tid +++ b/editions/tw5.com/tiddlers/howtos/KeyboardShortcuts.tid @@ -1,13 +1,13 @@ created: 20140526204527418 -modified: 20150514091409984 +modified: 20160418152500162 tags: Features [[Working with TiddlyWiki]] title: KeyboardShortcuts type: text/vnd.tiddlywiki -Keyboard shortcut support is currently very limited but will be improved in later releases. +Keyboard shortcuts are available for common editing operations: -! Editing Shortcuts +* Confirming changes to the draft tiddler containing the keyboard focus (defaults to <kbd>ctrl-Enter</kbd> +* Abandoning changes to the draft tiddler containing the keyboard focus (defaults to <kbd>escape</kbd>) +* Formatting operations from the tiddler editing toolbar (see the tooltips) -|Key |Shortcut description | -|<kbd>ctrl-enter</kbd> |Confirm changes to the draft tiddler containing the keyboard focus | -|<kbd>escape</kbd> |Abandon changes to the draft tiddler containing the keyboard focus | +The current shortcuts can be inspected and customised in the "Keyboard Shortcuts" tab of [[control panel|$:/ControlPanel]]. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/macros/colour-picker_Macro.tid b/editions/tw5.com/tiddlers/macros/colour-picker_Macro.tid new file mode 100644 index 000000000..0614754dd --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/colour-picker_Macro.tid @@ -0,0 +1,15 @@ +caption: colour-picker +created: 20160418152741901 +modified: 20160418154330605 +tags: Macros [[Core Macros]] +title: colour-picker Macro +type: text/vnd.tiddlywiki + +The <<.def colour-picker>> [[macro|Macros]] displays an interactive colour picker, as can be seen in the core bitmap editor. + +!! Parameters + +;actions +: Wikitext for the action widgets that should be executed when the user selects a colour. Within the text, the variable `colour-picker-value` contains the selected colour. + +<<.macro-examples "colour-picker">> diff --git a/editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Example_1).tid b/editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Example_1).tid new file mode 100644 index 000000000..4c767f706 --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Example_1).tid @@ -0,0 +1,15 @@ +created: 20160418154853776 +modified: 20160418155450547 +tags: +title: colour-picker Macro (Example 1) +type: text/vnd.tiddlywiki + +Colour: <$edit-text tiddler='$:/_MyColour' tag='input' placeholder='(unset)' default=''/> + +--- + +<$macrocall $name='colour-picker' actions=" + +<$action-setfield $tiddler='$:/_MyColour' $value=<<colour-picker-value>>/> + +"/> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Examples).tid b/editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Examples).tid new file mode 100644 index 000000000..8b8e1c79a --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/colour-picker_Macro_(Examples).tid @@ -0,0 +1,7 @@ +created: 20160418152735536 +modified: 20160418155324847 +tags: [[changecount Macro]] [[Macro Examples]] +title: colour-picker Macro (Examples) +type: text/vnd.tiddlywiki + +<$macrocall $name=".example" n="1" eg={{colour-picker Macro (Example 1)}}/> diff --git a/editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Example_1).tid b/editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Example_1).tid new file mode 100644 index 000000000..5c13646ca --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Example_1).tid @@ -0,0 +1,17 @@ +created: 20160418155523369 +modified: 20160418155913663 +tags: +title: image-picker Macro (Example 1) +type: text/vnd.tiddlywiki + +Image: <$edit-text tiddler='$:/_MyImage' tag='input' placeholder='(unset)' default=''/> + +<$transclude tiddler={{$:/_MyImage}}/> + +--- + +<$macrocall $name='image-picker' actions=" + +<$action-setfield $tiddler='$:/_MyImage' $value=<<imageTitle>>/> + +"/> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Examples).tid b/editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Examples).tid new file mode 100644 index 000000000..5bc282ccb --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/examples/image-picker_Macro_(Examples).tid @@ -0,0 +1,7 @@ +created: 20160418155539132 +modified: 20160418155621890 +tags: [[changecount Macro]] [[Macro Examples]] +title: image-picker Macro (Examples) +type: text/vnd.tiddlywiki + +<$macrocall $name=".example" n="1" eg={{image-picker Macro (Example 1)}}/> diff --git a/editions/tw5.com/tiddlers/macros/image-picker_Macro.tid b/editions/tw5.com/tiddlers/macros/image-picker_Macro.tid new file mode 100644 index 000000000..cf04cee22 --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/image-picker_Macro.tid @@ -0,0 +1,15 @@ +caption: colour-picker +created: 20160418155531395 +modified: 20160418155805435 +tags: Macros [[Core Macros]] +title: image-picker Macro +type: text/vnd.tiddlywiki + +The <<.def image-picker>> [[macro|Macros]] displays an interactive image picker, as can be seen in the core text editor. + +!! Parameters + +;actions +: Wikitext for the action widgets that should be executed when the user selects an image. Within the text, the variable `imageTitle` contains the title of the tiddler containing the selected image. + +<<.macro-examples "image-picker">> diff --git a/editions/prerelease/tiddlers/Release 5.1.12.tid b/editions/tw5.com/tiddlers/releasenotes/Release 5.1.12.tid similarity index 50% rename from editions/prerelease/tiddlers/Release 5.1.12.tid rename to editions/tw5.com/tiddlers/releasenotes/Release 5.1.12.tid index c046e1063..378121883 100644 --- a/editions/prerelease/tiddlers/Release 5.1.12.tid +++ b/editions/tw5.com/tiddlers/releasenotes/Release 5.1.12.tid @@ -1,6 +1,6 @@ caption: 5.1.12 created: 20160205184203773 -modified: 20160205184203773 +modified: 20160418160807002 tags: ReleaseNotes title: Release 5.1.12 type: text/vnd.tiddlywiki @@ -9,9 +9,35 @@ type: text/vnd.tiddlywiki ! Major Improvements -!! New Text Editor Toolbars +!! New Editor Toolbars -[[Added|https://github.com/Jermolene/TiddlyWiki5/pull/2315]] support for extensible formatting toolbars for the edit-text widget. +[[Added|https://github.com/Jermolene/TiddlyWiki5/pull/2315]] support for extensible formatting toolbars for the editor widgets. + +* Formatting operations for WikiText, with support for Markdown: +** Character formatting operations for bold, italic, strikethrough, underline, superscript, subscript, inline monospace +** Line formatting operations for monospaced blocks, quoting, headings and both numbered and bulleted lists +** Insert picture from a dropdown chooser +** Stamp snippet of pre-programmed text +** Excise selected text into a new tiddler +** Optional automatic resizing to fit content +* Full keyboard shortcut editor in control panel. Shortcuts are also shown in the toolbar button tooltips + +!! Improved Bitmap Editor + +The bitmap editor has been enhanced with a toolbar supporting: + +* Painting with selectable colour, width and opacity +* Clearing the image +* Resizing the image +* Keeping track of recently chosen colours + +!! Improved CodeMirror Plugin + +The CodeMirror plugin has been updated to version 5.13.2, and integrated with the new editor toolbars. The default configuration has been updated to include syntax highlighting for HTML, ~JavaScript, CSS, XML, TiddlyWiki Classic and Markdown. + +!! Improved Markdown Plugin + +The Markdown plugin includes formatting toolbar buttons and a new "new markdown tiddler" button in the Tools tab of the sidebar. !! New Evernote Plugin @@ -39,11 +65,16 @@ The new `tiddlywiki/internals` plugin provides features to help understand the i !! Usability Improvements +* Addition of “new image” button to the “Tools” tab of the sidebar +* Introduction of new general purpose [[colour-picker Macro]] +* Introduction of new general purpose [[image-picker macro]] * [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/adf45b346847a81d4ed26397466daa4514035bb9]] a bulk delete button to [[advanced search|$:/AdvancedSearch]] "Filter" tab !! Hackability Improvements -* [[Extended|https://github.com/Jermolene/TiddlyWiki5/commit/<TODO>]] editor preview pane to allow plugins to add further types of preview (see the new `tiddlywiki/internals` plugin for an example) +* [[Introduction|https://github.com/Jermolene/TiddlyWiki5/issues/2337]] of the new WikifyWidget +* [[Introduction|]] of new EditShortcutWidget for direct entry of keyboard shortcut codes +* [[Extended|https://github.com/Jermolene/TiddlyWiki5/commit/7daebba46bad0e7ea3e4dfc1fc2e59e36414a683]] editor preview pane to allow plugins to add further types of preview (see the new `tiddlywiki/internals` plugin for an example) !! Bug Fixes diff --git a/editions/tw5.com/tiddlers/roadmap/RoadMap.tid b/editions/tw5.com/tiddlers/roadmap/RoadMap.tid index cc4a01739..6765c0461 100644 --- a/editions/tw5.com/tiddlers/roadmap/RoadMap.tid +++ b/editions/tw5.com/tiddlers/roadmap/RoadMap.tid @@ -1,22 +1,17 @@ created: 20130823203800000 -modified: 20140916132209824 +modified: 20160418123722695 tags: About title: RoadMap type: text/vnd.tiddlywiki -Even though TiddlyWiki is now out of beta, there are still many improvements planned for the coming months: +There are still some areas of TiddlyWiki that have not been fully developed beyond the experimental stage: -* Fixing hangovers from TiddlyWikiClassic -* ~TiddlyWiki file format (to avoid illegal attribute names) -* Aliases (alternative titles for tiddlers) -* Search and replace -* Tiddler renaming -* Rich link tooltips, incorporating a preview -* More keyboard shortcuts -* Keyboard snippet expansion in the text editor -* List editor with drag and drop -* Selective/weighted searching by title, body and fields -* Maths notation +* Multiple users with the client-server configuration +* Smartphone user experience +* New tiddler manager, including bulk operations like search and replace +* Federation that can run in the browser or under Node.js +* Improved editions +* Improved support for third party plugin libraries Also see the issues list on GitHub: https://github.com/Jermolene/TiddlyWiki5 diff --git a/editions/tw5.com/tiddlers/widgets/EntityWidget.tid b/editions/tw5.com/tiddlers/widgets/EntityWidget.tid new file mode 100644 index 000000000..1c649cdc5 --- /dev/null +++ b/editions/tw5.com/tiddlers/widgets/EntityWidget.tid @@ -0,0 +1,17 @@ +caption: entity +created: 20160314165608218 +modified: 20160314165658703 +tags: Widgets +title: EntityWidget +type: text/vnd.tiddlywiki + +! Introduction + +The entity widget displays a specified HTML character entity. + +! Content and Attributes + +The content of the `<$entity>` widget is not used. + +|!Attribute |!Description | +|entity |The entity to display (eg, `×`) | diff --git a/editions/tw5.com/tiddlers/widgets/KeyboardWidget.tid b/editions/tw5.com/tiddlers/widgets/KeyboardWidget.tid index 69a784bff..7873cc858 100644 --- a/editions/tw5.com/tiddlers/widgets/KeyboardWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/KeyboardWidget.tid @@ -1,27 +1,27 @@ caption: keyboard created: 20140302192136805 -modified: 20151224141005939 +modified: 20160418151713895 tags: Widgets title: KeyboardWidget type: text/vnd.tiddlywiki ! Introduction -The keyboard widget allows ActionWidgets to be triggered by specific key combinations. There is also a shorthand for generating [[Messages]]. +The keyboard widget allows ActionWidgets to be triggered by specific key combinations. There is also a shorthand for generating [[Messages]] via the `message` and `param` attributes. ! Content and Attributes -The content of the `<$keyboard>` widget is rendered normally. The keyboard shortcut only takes effect within the contained content. +The content of the `<$keyboard>` widget is rendered normally. The keyboard shortcuts only take effect when the focus is within the contained content. |!Attribute |!Description | |message |The title of the [[WidgetMessage|Messages]] to generate | |param |The parameter to be passed with the [[WidgetMessage|Messages]] | -|key |Key string identifying the key to be trapped (see below) | +|key |Key string identifying the key(s) to be trapped (see below) | |class |A CSS class to be assigned to the generated HTML DIV element | ! Key Strings -Key strings are made up of zero or more of the modifiers <kbd>alt</kbd>, <kbd>shift</kbd> or <kbd>ctrl</kbd> followed by the name of a key, all joined with "+" plus symbols. Key names are either the letter or digit printed on the key (eg "a" or "1"), or one of the special keys <kbd>backspace</kbd>, <kbd>tab</kbd>, <kbd>enter</kbd> or <kbd>escape</kbd>. +Key strings are made up of one or more key specifiers separated by spaces. Each key specifier is zero or more of the modifiers <kbd>alt</kbd>, <kbd>shift</kbd>, <kbd>ctrl</kbd> or <kbd>meta</kbd> followed by the name of a key, all joined with "+" plus or "-" minus symbols. Key names are either the letter or digit printed on the key (eg "a" or "1"), or one of the special keys <kbd>backspace</kbd>, <kbd>tab</kbd>, <kbd>enter</kbd> or <kbd>escape</kbd>. For example: diff --git a/editions/tw5.com/tiddlers/widgets/WikifyWidget.tid b/editions/tw5.com/tiddlers/widgets/WikifyWidget.tid new file mode 100644 index 000000000..5b9670e49 --- /dev/null +++ b/editions/tw5.com/tiddlers/widgets/WikifyWidget.tid @@ -0,0 +1,28 @@ +title: WikifyWidget +created: 20160321144949700 +modified: 20160321144949700 +tags: Widgets +caption: wikify + +! Introduction + +The wikify widget parses and renders a string of text and assigns the result to a specified [[variable|Variables]]. The new value of the variable is available to the content within the wikify widget. + +! Content and Attributes + +The content of the `<$wikify>` widget is the scope for the value assigned to the variable. + +|!Attribute |!Description | +|name |The name of the variable to assign | +|text |The text to parse and render | +|type |The ContentType of the text (defaults to `text/vnd.tiddlywiki`) | +|mode |The parse mode: `block` (the default) or `inline` | +|output |Keyword indicating the desired output type, defaulting to `text` (see below) | + +The available output types are: + +|!Keyword |!Description | +|text |Return the plain text of the rendered output (ie HTML tags are omitted) | +|html |Return the rendered HTML of the output | +|parsetree |Return a formatted JSON representation of the parse tree | +|widgettree |Return a formatted JSON representation of the widget tree | diff --git a/languages/ca-ES/EditTemplate.multids b/languages/ca-ES/EditTemplate.multids index faab7be62..5b33e367a 100644 --- a/languages/ca-ES/EditTemplate.multids +++ b/languages/ca-ES/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Aquest és un tiddler extern desat fora del fitxer del TiddlyWiki principal. Podeu editar les etiquetes i camps però no podeu editar directament el seu contingut -Body/Hint: Useu el [[text wiki|http://tiddlywiki.com/static/WikiText.html]] per afegir format, imagtes, i característiques dinàmiques Body/Placeholder: Escribiu el text per aquest tiddler -Body/Preview/Button/Hide: amaga la previsualització -Body/Preview/Button/Show: mostra la previsualització Field/Remove/Caption: suprimeix el camp Field/Remove/Hint: Suprimeix el camp Fields/Add/Button: afegeix diff --git a/languages/cs-CZ/EditTemplate.multids b/languages/cs-CZ/EditTemplate.multids index 5b64081af..ab81b5c93 100644 --- a/languages/cs-CZ/EditTemplate.multids +++ b/languages/cs-CZ/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Tohle je externí tiddler uložený mimo hlavní soubor TiddlyWiki. Můžete upravovat štítky a pole, ale nemůžete přímo upravovat samotný obsah -Body/Hint: Použijte [[wiki text|http://tiddlywiki.com/static/WikiText.html]] pro vložení formátování, obrázků a pod. Body/Placeholder: Vložte text... -Body/Preview/Button/Hide: skrýt náhled -Body/Preview/Button/Show: náhled Field/Remove/Caption: odstranit pole Field/Remove/Hint: Odstranit pole Fields/Add/Button: přidat diff --git a/languages/da-DK/EditTemplate.multids b/languages/da-DK/EditTemplate.multids index 6ce4ae025..003f993f3 100644 --- a/languages/da-DK/EditTemplate.multids +++ b/languages/da-DK/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Dette er en indlejret tiddler hentet fra et eksternt tiddlywikidokument. Du kan redigere tags og felter men kan ikke direkte redigere selve indholdet -Body/Hint: Brug [[wiki text|http://tiddlywiki.com/static/WikiText.html]] til at tilføje formatering, billeder og dynamiske egenskaber Body/Placeholder: Skriv denne tiddlers tekst -Body/Preview/Button/Hide: skjul forhåndsvisning -Body/Preview/Button/Show: vis forhåndsvisning Field/Remove/Caption: fjern felt Field/Remove/Hint: Fjern felt Fields/Add/Button: tilføj diff --git a/languages/de-DE/EditTemplate.multids b/languages/de-DE/EditTemplate.multids index 7a9c64e44..f1e1ef735 100644 --- a/languages/de-DE/EditTemplate.multids +++ b/languages/de-DE/EditTemplate.multids @@ -1,12 +1,14 @@ title: $:/language/EditTemplate/ Body/External/Hint: Diese ist ein externer Tiddler, der nicht im TW file gespeichert ist. Sie können die "Tags" und "Feld" Texte ändern, jedoch nicht den Inhalt des Tiddlers! -Body/Hint: Verwenden Sie zum Formatieren [[WikiText|http://tiddlywiki.com/static/WikiText.html]]. Body/Placeholder: Geben Sie den Text für diesen Tiddler ein. +<<<<<<< HEAD +======= Body/Preview/Button/Hide: Vorschau aus Body/Preview/Button/Show: Vorschau Body/Preview/Type: Vorschau Typ: Body/Preview/Type/Output: Anzeige +>>>>>>> master Field/Remove/Caption: Lösche Feld Field/Remove/Hint: Lösche Feld Fields/Add/Button: ok diff --git a/languages/el-GR/EditTemplate.multids b/languages/el-GR/EditTemplate.multids index c3e84dfe1..b95ca81f8 100644 --- a/languages/el-GR/EditTemplate.multids +++ b/languages/el-GR/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Αυτό είναι ένα εξωτερικό tiddler αποθηκευμένο εκτός του κύριου TiddlyWiki αρχείου. Μπορείτε να τροποποιήσετε τις ετικέτες και τα πεδία αλλά δεν μπορείτε να τροποποιήσετε άμεσα το ίδιο το περιεχόμενο του -Body/Hint: Χρησιμοποιήστε [[wiki text|http://tiddlywiki.com/static/WikiText.html]] για να προσθέσετε μορφοποιήσεις, εικόνες, και δυναμικά χαρακτηριστικά Body/Placeholder: Πληκτρολογήστε το κείμενο για αυτό το tiddler -Body/Preview/Button/Hide: απόκρυψη προεπισκόπισης -Body/Preview/Button/Show: εμφάνιση προεπισκόπισης Fields/Add/Button: προσθήκη Fields/Add/Name/Placeholder: όνομα πεδίου Fields/Add/Prompt: Πρόσθεσε ένα νέο πεδίο: diff --git a/languages/es-ES/EditTemplate.multids b/languages/es-ES/EditTemplate.multids index c5c664545..fd48a09b5 100644 --- a/languages/es-ES/EditTemplate.multids +++ b/languages/es-ES/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Este es un tiddler externo guardado fuera del archivo TiddlyWiki principal. Se puede editar las etiquetas y campos pero no se puede editar directamente el contenido -Body/Hint: Usar [[texto wiki (instrucciones en inglés)|http://tiddlywiki.com/static/WikiText.html]] para añadir formato, imágenes y efectos dinámicos. Body/Placeholder: Escribir el texto de este tiddler -Body/Preview/Button/Hide: ocultar vista previa -Body/Preview/Button/Show: mostrar vista previa Field/Remove/Caption: eliminar campo Field/Remove/Hint: Eliminar campo Fields/Add/Button: añadir diff --git a/languages/fr-FR/Buttons.multids b/languages/fr-FR/Buttons.multids index 8abab75eb..cc49a7c54 100644 --- a/languages/fr-FR/Buttons.multids +++ b/languages/fr-FR/Buttons.multids @@ -62,6 +62,10 @@ NewJournal/Caption: nouveau journal NewJournal/Hint: Crée un nouveau tiddler journal NewJournalHere/Caption: nouveau journal, ici NewJournalHere/Hint: Crée un nouveau tiddler journal avec pour tag le tiddler courant +NewImage/Caption: nouvelle image +NewImage/Hint: Crée une nouveau tiddler image +NewMarkdown/Caption: nouveau tiddler Markdown +NewMarkdown/Hint: Crée un nouveau tiddler avec la syntaxe Markdown NewTiddler/Caption: nouveau tiddler NewTiddler/Hint: Créer un nouveau tiddler OpenWindow/Caption: ouvrir dans une nouvelle fenêtre @@ -88,3 +92,80 @@ TagManager/Caption: gestionnaire de tags TagManager/Hint: Gestionnaire de tags Theme/Caption: thème Theme/Hint: Choix du thème pour l'affichage +Bold/Caption: gras +Bold/Hint: Mettre la sélection en gras +Clear/Caption: effacer +Clear/Hint: Remplace l'image par une couleur pleine +EditorHeight/Caption: hauteur de l'éditeur +EditorHeight/Caption/Auto: Ajuste automatiquement la hauteur en fonction du contenu +EditorHeight/Caption/Fixed: Hauteur fixe : +EditorHeight/Hint: Choisir la hauteur de l'éditeur de texte +Excise/Caption: exciser +Excise/Caption/Excise: Effectue une excision +Excise/Caption/MacroName: Nom de la macro : +Excise/Caption/NewTitle: Titre du nouveau tiddler : +Excise/Caption/Replace: Remplacer le texte excisé par : +Excise/Caption/Replace/Macro: macro +Excise/Caption/Replace/Link: lien +Excise/Caption/Replace/Transclusion: transclusion +Excise/Caption/Tag: Utiliser le titre de ce tiddler comme tag du nouveau tiddler +Excise/Caption/TiddlerExists: Attention : le tiddler existe déjà +Excise/Hint: Exciser le texte sélectionner vers un nouveau tiddler +Heading1/Caption: en-tête 1 +Heading1/Hint: Appliquer le formatage des en-têtes de niveau 1 aux lignes de la sélection +Heading2/Caption: en-tête 2 +Heading2/Hint: Appliquer le formatage des en-têtes de niveau 2 aux lignes de la sélection +Heading3/Caption: en-tête 3 +Heading3/Hint: Appliquer le formatage des en-têtes de niveau 3 aux lignes de la sélection +Heading4/Caption: en-tête 4 +Heading4/Hint: Appliquer le formatage des en-têtes de niveau 4 aux lignes de la sélection +Heading5/Caption: en-tête 5 +Heading5/Hint: Appliquer le formatage des en-têtes de niveau 5 aux lignes de la sélection +Heading6/Caption: en-tête 6 +Heading6/Hint: Appliquer le formatage des en-têtes de niveau 6 aux lignes de la sélection +Italic/Caption: italiques +Italic/Hint: Mettre la sélection en italiques +LineWidth/Caption: épaisseur du trait +LineWidth/Hint: Choisir une épaisseur de trait pour le remplissage +ListBullet/Caption: liste à puces +ListBullet/Hint: Formater les lignes de la sélection comme une liste à puces +ListNumber/Caption: liste numérotée +ListNumber/Hint: Formater les lignes de la sélection comme une liste numérotée +MonoBlock/Caption: bloc de chasse constante +MonoBlock/Hint: Formater les lignes de la sélection en bloc de chasse constante +MonoLine/Caption: chasse constante +MonoLine/Hint: Formater la sélection avec une police de caractères à chasse constante +Opacity/Caption: opacité +Opacity/Hint: Choisit l'opacité du remplissage +Paint/Caption: couleur de remplissage +Paint/Hint: Choisit la couleur de remplissage +Picture/Caption: image +Picture/Hint: Insérer une image +Preview/Caption: prévisualisation +Preview/Hint: Affiche le panneau de prévisualisation +PreviewType/Caption: type de prévisualisation +PreviewType/Hint: Choisit le type de prévisualisation +Quote/Caption: citation +Quote/Hint: Formate les lignes de la sélection comme une citation +Redo/Caption: rétablir +Redo/Hint: Rétablit la dernière action annulée +Size/Caption: taille de l'image +Size/Caption/Height: Hauteur : +Size/Caption/Resize: Retailler l'image +Size/Caption/Width: Largeur : +Size/Hint: Choisit la taille de l'image +Stamp/Caption: tampon +Stamp/Caption/New: Ajoutez le vôtre +Stamp/Hint: Insère un fragment de texte prédéterminé +Stamp/New/Title: Nom tel qu'il apparaît dans le menu +Stamp/New/Text: Texte du fragment. (N'oubliez pas d'ajouter une légende dans le champ //caption//.) +Strikethrough/Caption: barré +Strikethrough/Hint: Barre le texte sélectionné +Subscript/Caption: indice +Subscript/Hint: Met en indice le texte sélectionné +Superscript/Caption: exposant +Superscript/Hint: Met en exposant le texte sélectionné +Underline/Caption: souligné +Underline/Hint: Souligne le texte sélectionné +Undo/Caption: annuler +Undo/Hint: Annule la dernière action diff --git a/languages/fr-FR/ControlPanel.multids b/languages/fr-FR/ControlPanel.multids index ce8982429..2c176943f 100644 --- a/languages/fr-FR/ControlPanel.multids +++ b/languages/fr-FR/ControlPanel.multids @@ -27,6 +27,19 @@ EditorTypes/Hint: Ces tiddlers déterminent l'éditeur à utiliser pour éditer EditorTypes/Type/Caption: Type Info/Caption: Info Info/Hint: Information sur ce TiddlyWiki +KeyboardShortcuts/Add/Prompt: Entre le raccourci ici +KeyboardShortcuts/Add/Caption: ajoute un raccourci +KeyboardShortcuts/Caption: Raccourcis clavier +KeyboardShortcuts/Hint: Gère la spécification des raccourcis clavier +KeyboardShortcuts/NoShortcuts/Caption: Aucun raccourci clavier spécifié +KeyboardShortcuts/Remove/Hint: supprime le raccourci clavier +KeyboardShortcuts/Platform/All: Toutes plates-formes +KeyboardShortcuts/Platform/Mac: Plate-forme Macintosh seulement +KeyboardShortcuts/Platform/NonMac: Plates-formes non-Macintosh seulement +KeyboardShortcuts/Platform/Linux: Plate-forme Linux seulement +KeyboardShortcuts/Platform/NonLinux: Plate-formes non-Linux seulement +KeyboardShortcuts/Platform/Windows: Plate-forme Windows seulement +KeyboardShortcuts/Platform/NonWindows: Plates-formes non-Windows seulement LoadedModules/Caption: Modules chargés LoadedModules/Hint: Liste des modules chargés, avec leurs tiddlers sources. Les italiques indiquent que les tiddlers sources n'existent pas, le plus souvent parce que le module a été créé lors du processus d'amorçage. Palette/Caption: Palette @@ -40,6 +53,7 @@ Palette/Prompt: Palette en cours : Palette/ShowEditor/Caption: Afficher l'éditeur Plugins/Add/Hint: Installer des plugins à partir de la bibliothèque officielle Plugins/Add/Caption: Ajouter des plugins +Plugins/AlreadyInstalled: Ce plugin est déjà installé dans la version <$text text=<<installedVersion>>/> Plugins/Caption: Plugins Plugins/Disable/Caption: désactiver Plugins/Disable/Hint: Désactive ce plugin au prochain rechargement de la page @@ -51,6 +65,8 @@ Plugins/Install: installe Plugins/Installed/Hint: Plugins installés : Plugins/Languages/Caption: Languages Plugins/Languages/Hint: Plugins de langue +Plugins/NoInformation: Aucune information disponible +Plugins/NotInstalled: Ce plugin n'est pas installé Plugins/OpenPluginLibrary: ouvre la bibliothèque de plugins Plugins/Plugins/Caption: Plugins Plugins/Plugins/Hint: Plugins @@ -118,6 +134,9 @@ Settings/TitleLinks/Caption: Titres des tiddlers Settings/TitleLinks/Hint: Faut-il afficher les titres des tiddlers comme des liens ? Settings/TitleLinks/No/Description: Ne pas afficher les titres des tiddlers comme des liens Settings/TitleLinks/Yes/Description: Afficher les titres des tiddlers comme des liens +Settings/MissingLinks/Caption: Liens wiki +Settings/MissingLinks/Hint: Peut-on pointer vers des tiddlers qui n'existent pas encore ? +Settings/MissingLinks/Description: Active les liens vers les tiddlers inexistants StoryView/Caption: Vue sur le déroulé StoryView/Prompt: Vue courante : Theme/Caption: Thème @@ -130,6 +149,8 @@ Toolbars/EditToolbar/Hint: Choix des boutons à afficher pour les tiddlers en co Toolbars/Hint: Choix des boutons à afficher dans les barres d'outils Toolbars/PageControls/Caption: Barre d'outils de la page Toolbars/PageControls/Hint: Choix des boutons à afficher sur la barre d'outils principale de la page +Toolbars/EditorToolbar/Caption: Barre d'outils de l'Éditeur +Toolbars/EditorToolbar/Hint: Choisir les boutons à afficher dans la barre d'outils de l'éditeur. À noter que la présence de certains boutons dépendra du type du tiddler édité Toolbars/ViewToolbar/Caption: Barre d'outils du mode visualisation Toolbars/ViewToolbar/Hint: Choix des boutons à afficher pour les tiddlers en mode visualisation Tools/Download/Full/Caption: Télécharger le wiki complet diff --git a/languages/fr-FR/EditTemplate.multids b/languages/fr-FR/EditTemplate.multids index 6eb3fb60f..d9aa0eef9 100644 --- a/languages/fr-FR/EditTemplate.multids +++ b/languages/fr-FR/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Ceci est un tiddler externe, conservé en dehors du fichier TiddlyWiki principal. Vous pouvez éditer les tags et les champs mais pas directement le contenu lui-même -Body/Hint: Utilisez [[WikiText|http://tiddlywiki.com/static/WikiText.html]] pour formater ou ajouter des images et des fonctions dynamiques Body/Placeholder: Entrez le texte ici -Body/Preview/Button/Hide: Cacher la prévisualisation -Body/Preview/Button/Show: Afficher la prévisualisation Field/Remove/Caption: supprimer le champ Field/Remove/Hint: Supprime le champ Fields/Add/Button: ajouter @@ -19,6 +16,7 @@ Tags/Add/Button: ajouter Tags/Add/Placeholder: nom du tag Tags/Dropdown/Caption: liste des tags Tags/Dropdown/Hint: Montre la liste des tags +Title/BadCharacterWarning: Attention : il est préférable d'éviter l'usage des caractères <<bad-chars>> dans les titres de tiddlers Type/Dropdown/Caption: liste des types de contenu Type/Dropdown/Hint: Montre la liste des types de contenu Type/Delete/Caption: supprimer le type de contenu diff --git a/languages/fr-FR/Snippets/ListByTag.tid b/languages/fr-FR/Snippets/ListByTag.tid new file mode 100644 index 000000000..05309f49e --- /dev/null +++ b/languages/fr-FR/Snippets/ListByTag.tid @@ -0,0 +1,6 @@ +title: $:/language/Snippets/ListByTag +tags: $:/tags/TextEditor/Snippet +caption: Liste de tiddlers par tag +mode: wikified + +<<list-links "[tag[task]sort[title]]">> diff --git a/languages/fr-FR/Snippets/Table 4x3.tid b/languages/fr-FR/Snippets/Table 4x3.tid new file mode 100644 index 000000000..51cb71807 --- /dev/null +++ b/languages/fr-FR/Snippets/Table 4x3.tid @@ -0,0 +1,9 @@ +title: $:/language/Snippets/Table4x3 +tags: $:/tags/TextEditor/Snippet +caption: Tableau avec 4 colonnes par trois lignes +mode: wikified + +|! |!Alpha |!Beta |!Gamma |!Delta | +|!Un | | | | | +|!Deux | | | | | +|!Trois | | | | | diff --git a/languages/fr-FR/Snippets/TableOfContents.tid b/languages/fr-FR/Snippets/TableOfContents.tid new file mode 100644 index 000000000..265b0540f --- /dev/null +++ b/languages/fr-FR/Snippets/TableOfContents.tid @@ -0,0 +1,10 @@ +title: $:/language/Snippets/TableOfContents +tags: $:/tags/TextEditor/Snippet +caption: Table des matières +mode: wikified + +<div class="tc-table-of-contents"> + +<<toc-selective-expandable 'TableOfContents'>> + +</div> \ No newline at end of file diff --git a/languages/hi-IN/EditTemplate.multids b/languages/hi-IN/EditTemplate.multids index 7af2905c4..8e626c814 100644 --- a/languages/hi-IN/EditTemplate.multids +++ b/languages/hi-IN/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: यह मुख्य टिड्लीविकि फ़ाइल के बाहर संग्रहीत एक बाहरी tiddler है। आप टैग और क्षेत्रों को संपादित कर सकते हैं लेकिन सीधे ही सामग्री edit नहीं कर सकते -Body/Hint: उपयोग [[wiki text|http://tiddlywiki.com/static/WikiText.html]] स्वरूपण, चित्र, और गतिशील सुविधाओं को जोड़ने के लिए Body/Placeholder: इस tiddler के लिए text टाइप करें -Body/Preview/Button/Hide: प्रीव्यू छुपाना -Body/Preview/Button/Show: प्रीव्यू दिखाएँ Field/Remove/Caption: क्षेत्र को हटाने Field/Remove/Hint: क्षेत्र निकालें Fields/Add/Button: जोड़ना diff --git a/languages/ia-IA/EditTemplate.multids b/languages/ia-IA/EditTemplate.multids index dc83be964..c4b11dc96 100644 --- a/languages/ia-IA/EditTemplate.multids +++ b/languages/ia-IA/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Isto es un nota externe salvate extra le file principal del TiddlyWiki. Tu pote rediger le etiquettas e quadros ma non directemente rediger le contento mesme -Body/Hint: Usa [[wiki text|http://tiddlywiki.com/static/WikiText.html]] pro adder formatation, ligamines e functiones dynamic Body/Placeholder: Scribe le texto pro iste nota -Body/Preview/Button/Hide: cela previsualisation -Body/Preview/Button/Show: monstra previsualisation Field/Remove/Caption: remove quadro Field/Remove/Hint: Remove quadro Fields/Add/Button: adde diff --git a/languages/it-IT/EditTemplate.multids b/languages/it-IT/EditTemplate.multids index 8a53f3421..9a59c1dbc 100644 --- a/languages/it-IT/EditTemplate.multids +++ b/languages/it-IT/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Questo è un frammento esterno memorizzato al di fuori del file principale TiddlyWiki. Puoi editare le etichette ed i campi ma non puoi editare il contenuto -Body/Hint: Utilizza il formato wiki per definire la formattazione, aggiungere immagini e caratteristiche dinamiche Body/Placeholder: Digita il testo di questo frammento -Body/Preview/Button/Hide: Nascondi preview -Body/Preview/Button/Show: Mostra preview Field/Remove/Caption: Rimuovi campo Field/Remove/Hint: Rimuovi campo Fields/Add/Button: Aggiungi diff --git a/languages/ja-JP/EditTemplate.multids b/languages/ja-JP/EditTemplate.multids index 50e951038..e9262e402 100644 --- a/languages/ja-JP/EditTemplate.multids +++ b/languages/ja-JP/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: このtiddlerは外部のTiddlyWikiのファイルに保存されています。タグやフィールドの編集はできますが、実際の外部コンテンツを直接編集することはできません。 -Body/Hint: 表示を整形したり画像や動的な要素を使いたい場合は [[wiki text|http://tiddlywiki.com/static/WikiText.html]] 書式を使用してください。 Body/Placeholder: ここに tiddler の本文を入力してください。 -Body/Preview/Button/Hide: プレビューを隠す -Body/Preview/Button/Show: プレビューを表示 Field/Remove/Caption: fieldを削除 Field/Remove/Hint: fieldを削除 Fields/Add/Button: 追加 diff --git a/languages/ko-KR/EditTemplate.multids b/languages/ko-KR/EditTemplate.multids index 353bee48d..52a54ffa6 100644 --- a/languages/ko-KR/EditTemplate.multids +++ b/languages/ko-KR/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: 주요 TiddlyWiki 파일의 바깥에 저장된 바깥 티들러입니다. 태그와 필드를 편집할 수는 있지만 직접 내용 자체를 편집할 수는 없습니다 -Body/Hint: 서식, 그림, 및 동적 기능을 추가하려면 [[위키 텍스트|http://tiddlywiki.com/static/WikiText.html]]를 사용하세요 Body/Placeholder: 이 티들러에 대한 텍스트를 입력하세요 -Body/Preview/Button/Hide: 미리 보기 숨기기 -Body/Preview/Button/Show: 미리 보기 보이기 Body/Preview/Type: 미리 보기 형식: Body/Preview/Type/Output: 출력 Field/Remove/Caption: 필드 제거 diff --git a/languages/nl-NL/EditTemplate.multids b/languages/nl-NL/EditTemplate.multids index 44d89996d..412641bda 100644 --- a/languages/nl-NL/EditTemplate.multids +++ b/languages/nl-NL/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Dit is een externe tiddler die niet in de TiddlyWiki opgeslagen is. Je kan labels en velden wijzigen maar de tekst zelf niet. -Body/Hint: Gebruik [[wiki text|http://tiddlywiki.com/static/WikiText.html]] om het formaat aan te passen en plaatjes e.d. toe te voegen Body/Placeholder: Typ de tekst voor deze tiddler -Body/Preview/Button/Hide: verberg voorbeeld -Body/Preview/Button/Show: toon voorbeeld Field/Remove/Caption: verwijder veld Field/Remove/Hint: Verwijder veld Fields/Add/Button: + diff --git a/languages/pa-IN/EditTemplate.multids b/languages/pa-IN/EditTemplate.multids index f574cc7e9..d4c8ac1e7 100644 --- a/languages/pa-IN/EditTemplate.multids +++ b/languages/pa-IN/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: ਇਹ ਮੁੱਖ TiddlyWiki ਫਾਇਲ ਦੇ ਬਾਹਰ ਹੀ ਸੰਭਾਲਿਆ ਇੱਕ ਬਾਹਰੀ tiddler ਹੈ. ਤੁਸ ਟੈਗ ਅਤੇ ਖੇਤਰ ਨੂੰ ਸੋਧ ਸਕਦੇ ਹੋ, ਪਰ ਆਪਣੇ ਆਪ ਸਿੱਧੇ ਤੌਰ 'ਤੇ ਸਮੱਗਰੀ ਨੂੰ ਸੋਧ ਨਹੀ ਕਰ ਸਕਦੇ -Body/Hint: ਸ਼ਾਮਿਲ ਕਰਨ ਲਈ ਫਾਰਮਿਟ, ਚਿੱਤਰ, ਅਤੇ ਆਰਜੀ ਫੀਚਰ: | [//tiddlywiki.com/static/WikiText.html] http [ਵਿਕਿ ਟੈਕਸਟ] ਵਰਤੋ Body/Placeholder: ਪਾਠ ਟਾਈਪ ਲਈ ਇਸ tiddler ਨੂੰ ਵਰਤੋ -Body/Preview/Button/Hide: ਝਲਕ ਨੂੰ ਓਹਲੇ ਕਰਨ -Body/Preview/Button/Show: ਜਾਣਕਾਰੀ ਦੀ ਪ੍ਰਦਰਸ਼ਨੀ Field/Remove/Caption: ਖੇਤਰ ਨੂੰ ਹਟਾਉਣ Field/Remove/Hint: ਖੇਤਰ ਨੂੰ ਹਟਾਉਣ Fields/Add/Button: ਸ਼ਾਮਿਲ ਕਰੋ diff --git a/languages/pt-PT/EditTemplate.multids b/languages/pt-PT/EditTemplate.multids index 182fb3fad..77567761e 100644 --- a/languages/pt-PT/EditTemplate.multids +++ b/languages/pt-PT/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Este é um tiddler armazenado fora do ficheiro principal da Tiddlywiki. Pode mudar as etiquetas mas não pode editar o seu conteúdo -Body/Hint: Utilize [[texto wiki|http://tiddlywiki.com/static/WikiText.html]] para adicionar formatação, imagens e funcionalidades dinâmicas Body/Placeholder: Escreva o texto para este tiddler -Body/Preview/Button/Hide: esconder a pré visualização -Body/Preview/Button/Show: mostrar a pré visualização Field/Remove/Caption: remover campo Field/Remove/Hint: Remover campo Fields/Add/Button: adicionar diff --git a/languages/ru-RU/EditTemplate.multids b/languages/ru-RU/EditTemplate.multids index 7c8f97594..1fa298f32 100644 --- a/languages/ru-RU/EditTemplate.multids +++ b/languages/ru-RU/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Содержимое этой заметки находится вне TiddlyWiki. Но вы можете редактировать метки и поля -Body/Hint: Воспользуйтесь [[WikiText|http://tiddlywiki.com/static/WikiText.html]] для форматирования, добавления изображений и макросов Body/Placeholder: Введите текст заметки -Body/Preview/Button/Hide: скрыть предпросмотр -Body/Preview/Button/Show: предпросмотр Field/Remove/Caption: удалить поле Field/Remove/Hint: Удалить поле Fields/Add/Button: добавить diff --git a/languages/sk-SK/EditTemplate.multids b/languages/sk-SK/EditTemplate.multids index 16331e4a9..2493dd273 100644 --- a/languages/sk-SK/EditTemplate.multids +++ b/languages/sk-SK/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: Toto je externý tiddler uložený mimo hlavného TiddlyWiki súboru. Môžete editovať štítky a polia, ale nemôžete priamo editovať samotný obsah -Body/Hint: Na pridanie formátovania, obrázkov a dynamických vlastností použite [[wiki text|http://tiddlywiki.com/static/WikiText.html]] Body/Placeholder: Napíšte text pre tento tiddler -Body/Preview/Button/Hide: zatvor náhľad -Body/Preview/Button/Show: ukáž náhľad Field/Remove/Caption: odstrániť pole Field/Remove/Hint: Odstráň pole Fields/Add/Button: pridaj diff --git a/languages/sv-SE/EditTemplate.multids b/languages/sv-SE/EditTemplate.multids index 738fcde91..3cac50d09 100755 --- a/languages/sv-SE/EditTemplate.multids +++ b/languages/sv-SE/EditTemplate.multids @@ -1,10 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: This is an external tiddler stored outside of the main TiddlyWiki file. You can edit the tags and fields but cannot directly edit the content itself -Body/Hint: Use [[wiki text|http://tiddlywiki.com/static/WikiText.html]] to add formatting, images, and dynamic features Body/Placeholder: Type the text for this tiddler -Body/Preview/Button/Hide: göm förhandsvisning -Body/Preview/Button/Show: visa förhandsvisning Field/Remove/Caption: ta bort fält Field/Remove/Hint: Ta bort fält Fields/Add/Button: lägg till diff --git a/languages/zh-Hans/Buttons.multids b/languages/zh-Hans/Buttons.multids index afff59416..4f0c27bd9 100644 --- a/languages/zh-Hans/Buttons.multids +++ b/languages/zh-Hans/Buttons.multids @@ -62,6 +62,10 @@ NewJournal/Caption: 添加日志 NewJournal/Hint: 创建一个新的日志条目 NewJournalHere/Caption: 添加子日志 NewJournalHere/Hint: 创建一个标签含此条目名称的新日志条目 +NewImage/Caption: 添加图像 +NewImage/Hint: 创建一个新的图像条目 +NewMarkdown/Caption: 添加 Markdown 条目 +NewMarkdown/Hint: 创建一个新的 Markdown 条目 NewTiddler/Caption: 添加条目 NewTiddler/Hint: 创建一个新的条目 OpenWindow/Caption: 开启于新窗口 @@ -88,3 +92,80 @@ TagManager/Caption: 标签管理 TagManager/Hint: 标签管理 Theme/Caption: 布景主题 Theme/Hint: 选择布景主题 +Bold/Caption: 粗体 +Bold/Hint: 套用粗体格式于所选文本 +Clear/Caption: 清除 +Clear/Hint: 清除图像为纯色 +EditorHeight/Caption: 编辑器高度 +EditorHeight/Caption/Auto: 自动调整高度以适合内容 +EditorHeight/Caption/Fixed: 固定高度︰ +EditorHeight/Hint: 选择文本编辑器的高度 +Excise/Caption: 剪切 +Excise/Caption/Excise: 执行剪切 +Excise/Caption/MacroName: 宏的名称︰ +Excise/Caption/NewTitle: 新条目的名称︰ +Excise/Caption/Replace: 替换剪切的文本为: +Excise/Caption/Replace/Macro: 宏 +Excise/Caption/Replace/Link: 链接 +Excise/Caption/Replace/Transclusion: 嵌入 +Excise/Caption/Tag: 将新条目的标签设为此条目的名称 +Excise/Caption/TiddlerExists: 警示:条目已经存在 +Excise/Hint: 剪切所选文本到一个新条目 +Heading1/Caption: 标题 1 +Heading1/Hint: 套用标题级别 1 的格式于包含所选文本的列 +Heading2/Caption: 标题 2 +Heading2/Hint: 套用标题级别 2 的格式于包含所选文本的列 +Heading3/Caption: 标题 3 +Heading3/Hint: 套用标题级别 3 的格式于包含所选文本的列 +Heading4/Caption: 标题 4 +Heading4/Hint: 套用标题级别 4 的格式于包含所选文本的列 +Heading5/Caption: 标题 5 +Heading5/Hint: 套用标题级别 5 的格式于包含所选文本的列 +Heading6/Caption: 标题 6 +Heading6/Hint: 套用标题级别 6 的格式于包含所选文本的列 +Italic/Caption: 斜体 +Italic/Hint: 套用斜体格式于所选文本 +LineWidth/Caption: 线宽 +LineWidth/Hint: 设置绘画的线条宽度 +ListBullet/Caption: 符号清单 +ListBullet/Hint: 套用符号清单格式于包含所选文本的列 +ListNumber/Caption: 数字清单 +ListNumber/Hint: 套用数字清单格式于包含所选文本的列 +MonoBlock/Caption: 等宽区块 +MonoBlock/Hint: 套用等宽区块格式于包含所选文本的列 +MonoLine/Caption: 等宽 +MonoLine/Hint: 套用等宽字符格式于所选文本 +Opacity/Caption: 不透明度 +Opacity/Hint: 设置绘画的不透明度 +Paint/Caption: 绘画颜色 +Paint/Hint: 设置绘画的颜色 +Picture/Caption: 图片 +Picture/Hint: 插入图片 +Preview/Caption: 预览 +Preview/Hint: 显示预览窗格 +PreviewType/Caption: 预览类型 +PreviewType/Hint: 选择预览类型 +Quote/Caption: 引言 +Quote/Hint: 套用引言文本格式于包含所选文本的列 +Redo/Caption: 恢复 +Redo/Hint: 恢复上一次撤销的操作 +Size/Caption: 图像大小 +Size/Caption/Height: 高度︰ +Size/Caption/Resize: 调整图像的大小 +Size/Caption/Width: 宽度: +Size/Hint: 设置图像的大小 +Stamp/Caption: 印记 +Stamp/Caption/New: 添加您自己的 +Stamp/Hint: 插入一个预配置的文本片段 +Stamp/New/Title: 在选单中显示的标题 +Stamp/New/Text: 片段的文本。(记得在 `caption` 栏位中添加一个说明性的标题)。 +Strikethrough/Caption: 删除线 +Strikethrough/Hint: 套用删除线格式于所选文本 +Subscript/Caption: 下标 +Subscript/Hint: 套用下标格式于所选文本 +Superscript/Caption: 上标 +Superscript/Hint: 套用上标格式于所选文本 +Underline/Caption: 下划线 +Underline/Hint: 套用下划线格式于所选文本 +Undo/Caption: 撤消 +Undo/Hint: 撤消上一次的操作 diff --git a/languages/zh-Hans/ControlPanel.multids b/languages/zh-Hans/ControlPanel.multids index 3076d5528..a0788c2aa 100644 --- a/languages/zh-Hans/ControlPanel.multids +++ b/languages/zh-Hans/ControlPanel.multids @@ -27,6 +27,19 @@ EditorTypes/Hint: 这些条目决定使用哪个编辑器来编辑特定条目 EditorTypes/Type/Caption: 类型 Info/Caption: 信息 Info/Hint: 有关此 TiddlyWiki 的信息 +KeyboardShortcuts/Add/Prompt: 在此输入快捷键 +KeyboardShortcuts/Add/Caption: 添加快捷键 +KeyboardShortcuts/Caption: 快捷键 +KeyboardShortcuts/Hint: 管理键盘快捷键分配 +KeyboardShortcuts/NoShortcuts/Caption: 尚无指定快捷键 +KeyboardShortcuts/Remove/Hint: 删除快捷键 +KeyboardShortcuts/Platform/All: 所有平台 +KeyboardShortcuts/Platform/Mac: 仅 Macintosh 平台 +KeyboardShortcuts/Platform/NonMac: 仅非 Macintosh 平台 +KeyboardShortcuts/Platform/Linux: 仅 Linux 平台 +KeyboardShortcuts/Platform/NonLinux: 仅非 Linux 平台 +KeyboardShortcuts/Platform/Windows: 仅 Windows 平台 +KeyboardShortcuts/Platform/NonWindows: 仅非 Windows 平台 LoadedModules/Caption: 已加载的模块 LoadedModules/Hint: 这些是当前已加载的模块之源码条目。斜体的模块则无源码条目,通常是因为它们是在引导过程中设置。 Palette/Caption: 调色板 @@ -136,6 +149,8 @@ Toolbars/EditToolbar/Hint: 选择将显示哪些按钮于条目的编辑模式 Toolbars/Hint: 选择将显示哪些工具栏按钮 Toolbars/PageControls/Caption: 页面工具栏 Toolbars/PageControls/Hint: 选择将显示哪些按钮于主页面的工具栏 +Toolbars/EditorToolbar/Caption: 编辑器工具栏 +Toolbars/EditorToolbar/Hint: 选择将显示哪些按钮于编辑器工具栏。请注意,某些按钮只会出现在编辑某一类型的条目时。 Toolbars/ViewToolbar/Caption: 查看工具栏 Toolbars/ViewToolbar/Hint: 选择将显示哪些按钮于条目的查看模式工具栏 Tools/Download/Full/Caption: 下载完整副本 diff --git a/languages/zh-Hans/EditTemplate.multids b/languages/zh-Hans/EditTemplate.multids index d100d69f4..263c50cae 100644 --- a/languages/zh-Hans/EditTemplate.multids +++ b/languages/zh-Hans/EditTemplate.multids @@ -1,11 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: 这是保存于主要的 TiddlyWiki 文件之外的外部条目。你可以编辑其标签和栏位,但不能直接编辑内容本身 -Body/Hint: 使用 WikiText 来添加格式、图片及动态功能 Body/Placeholder: 输入此条目的内容 -Body/Preview/Button/Hide: 隐藏预览 -Body/Preview/Button/Show: 显示预览 -Body/Preview/Type: 预览类型: Body/Preview/Type/Output: 输出 Field/Remove/Caption: 删除栏位 Field/Remove/Hint: 删除栏位 diff --git a/languages/zh-Hans/GettingStarted.tid b/languages/zh-Hans/GettingStarted.tid index c14875e2d..940094b8e 100644 --- a/languages/zh-Hans/GettingStarted.tid +++ b/languages/zh-Hans/GettingStarted.tid @@ -11,7 +11,7 @@ title: GettingStarted |<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> | |<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> | -|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// | +|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// | </div> 请参阅[[控制台|$:/ControlPanel]]查看更多选项。 \ No newline at end of file diff --git a/languages/zh-Hans/Misc.multids b/languages/zh-Hans/Misc.multids index b05898fad..9f03eebb7 100644 --- a/languages/zh-Hans/Misc.multids +++ b/languages/zh-Hans/Misc.multids @@ -5,6 +5,7 @@ BinaryWarning/Prompt: 此条目包含二进制数据 ClassicWarning/Hint: 此条目以经典版 TiddlyWiki 标记格式撰写,不完全兼容新版 TiddlyWiki 的格式,详细信息请参阅:http://tiddlywiki.com/static/Upgrading。 ClassicWarning/Upgrade/Caption: 升级 CloseAll/Button: 全部关闭 +ColourPicker/Recent: 最近︰ ConfirmCancelTiddler: 您确定要放弃对条目 "<$text text=<<title>>/>" 的更改? ConfirmDeleteTiddler: 您确定要删除条目 "<$text text=<<title>>/>"? ConfirmOverwriteTiddler: 您确定要覆写条目 "<$text text=<<title>>/>"? diff --git a/languages/zh-Hans/Snippets/ListByTag.tid b/languages/zh-Hans/Snippets/ListByTag.tid new file mode 100644 index 000000000..e56499126 --- /dev/null +++ b/languages/zh-Hans/Snippets/ListByTag.tid @@ -0,0 +1,6 @@ +title: $:/language/Snippets/ListByTag +tags: $:/tags/TextEditor/Snippet +caption: 依标签筛选的条目列表 +mode: wikified + +<<list-links "[tag[task]sort[title]]">> diff --git a/languages/zh-Hans/Snippets/MacroDefinition.tid b/languages/zh-Hans/Snippets/MacroDefinition.tid new file mode 100644 index 000000000..307623d86 --- /dev/null +++ b/languages/zh-Hans/Snippets/MacroDefinition.tid @@ -0,0 +1,8 @@ +title: $:/language/Snippets/MacroDefinition +tags: $:/tags/TextEditor/Snippet +caption: 宏的定义 +mode: wikified + +\define macroName(param1:"默认值",param2) +宏的内容 +\end diff --git a/languages/zh-Hans/Snippets/Table 4x3.tid b/languages/zh-Hans/Snippets/Table 4x3.tid new file mode 100644 index 000000000..082e30957 --- /dev/null +++ b/languages/zh-Hans/Snippets/Table 4x3.tid @@ -0,0 +1,9 @@ +title: $:/language/Snippets/Table4x3 +tags: $:/tags/TextEditor/Snippet +caption: 4 x 3 的表格 +mode: wikified + +|! | !一 | !二 | !三 | !四 | +|! 1| | | | | +|! 2| | | | | +|! 3 | | | | | diff --git a/languages/zh-Hans/Snippets/TableOfContents.tid b/languages/zh-Hans/Snippets/TableOfContents.tid new file mode 100644 index 000000000..f8ad87fc5 --- /dev/null +++ b/languages/zh-Hans/Snippets/TableOfContents.tid @@ -0,0 +1,10 @@ +title: $:/language/Snippets/TableOfContents +tags: $:/tags/TextEditor/Snippet +caption: 目录 +mode: wikified + +<div class="tc-table-of-contents"> + +<<toc-selective-expandable 'TableOfContents'>> + +</div> \ No newline at end of file diff --git a/languages/zh-Hant/Buttons.multids b/languages/zh-Hant/Buttons.multids index 4843c94d7..b839bbe80 100644 --- a/languages/zh-Hant/Buttons.multids +++ b/languages/zh-Hant/Buttons.multids @@ -62,6 +62,10 @@ NewJournal/Caption: 新增日誌 NewJournal/Hint: 建立一個新的日誌條目 NewJournalHere/Caption: 新增子日誌 NewJournalHere/Hint: 建立一個標籤含此條目名稱的新日誌條目 +NewImage/Caption: 新增圖像 +NewImage/Hint: 建立一個新的圖像條目 +NewMarkdown/Caption: 新增 Markdown 條目 +NewMarkdown/Hint: 建立一個新的 Markdown 條目 NewTiddler/Caption: 新增條目 NewTiddler/Hint: 建立一個新的條目 OpenWindow/Caption: 開啟於新視窗 @@ -88,3 +92,80 @@ TagManager/Caption: 標籤管理 TagManager/Hint: 標籤管理 Theme/Caption: 佈景主題 Theme/Hint: 選擇佈景主題 +Bold/Caption: 粗體 +Bold/Hint: 套用粗體格式於所選文字 +Clear/Caption: 清除 +Clear/Hint: 清除圖像為純色 +EditorHeight/Caption: 編輯器高度 +EditorHeight/Caption/Auto: 自動調整高度以適合內容 +EditorHeight/Caption/Fixed: 固定高度︰ +EditorHeight/Hint: 選擇文字編輯器的高度 +Excise/Caption: 剪切 +Excise/Caption/Excise: 執行剪切 +Excise/Caption/MacroName: 巨集名稱︰ +Excise/Caption/NewTitle: 新條目的名稱︰ +Excise/Caption/Replace: 替換剪切的文本為: +Excise/Caption/Replace/Macro: 巨集 +Excise/Caption/Replace/Link: 鏈接 +Excise/Caption/Replace/Transclusion: 嵌入 +Excise/Caption/Tag: 將新條目的標籤設為此條目的名稱 +Excise/Caption/TiddlerExists: 警示:條目已經存在 +Excise/Hint: 剪切所選文字到一個新條目 +Heading1/Caption: 標題 1 +Heading1/Hint: 套用標題級別 1 的格式於包含所選文字的列 +Heading2/Caption: 標題 2 +Heading2/Hint: 套用標題級別 2 的格式於包含所選文字的列 +Heading3/Caption: 標題 3 +Heading3/Hint: 套用標題級別 3 的格式於包含所選文字的列 +Heading4/Caption: 標題 4 +Heading4/Hint: 套用標題級別 4 的格式於包含所選文字的列 +Heading5/Caption: 標題 5 +Heading5/Hint: 套用標題級別 5 的格式於包含所選文字的列 +Heading6/Caption: 標題 6 +Heading6/Hint: 套用標題級別 6 的格式於包含所選文字的列 +Italic/Caption: 斜體 +Italic/Hint: 套用斜體格式於所選文字 +LineWidth/Caption: 線寬 +LineWidth/Hint: 設定繪畫的線條寬度 +ListBullet/Caption: 符號清單 +ListBullet/Hint: 套用符號清單格式於包含所選文字的列 +ListNumber/Caption: 數字清單 +ListNumber/Hint: 套用數字清單格式於包含所選文字的列 +MonoBlock/Caption: 等寬區塊 +MonoBlock/Hint: 套用等寬區塊格式於包含所選文字的列 +MonoLine/Caption: 等寬 +MonoLine/Hint: 套用等寬字元格式於所選文字 +Opacity/Caption: 不透明度 +Opacity/Hint: 設定繪畫的不透明度 +Paint/Caption: 繪畫顏色 +Paint/Hint: 設定繪畫的顏色 +Picture/Caption: 圖片 +Picture/Hint: 插入圖片 +Preview/Caption: 預覽 +Preview/Hint: 顯示預覽窗格 +PreviewType/Caption: 預覽類型 +PreviewType/Hint: 選擇預覽類型 +Quote/Caption: 引言 +Quote/Hint: 套用引言文字格式於包含所選文字的列 +Redo/Caption: 重做 +Redo/Hint: 重做上一次還原的操作 +Size/Caption: 圖像大小 +Size/Caption/Height: 高度︰ +Size/Caption/Resize: 調整圖像的大小 +Size/Caption/Width: 寬度: +Size/Hint: 設定圖像的大小 +Stamp/Caption: 印記 +Stamp/Caption/New: 新增您自己的 +Stamp/Hint: 插入一個預配置的文字片段 +Stamp/New/Title: 在選單中顯示的標題 +Stamp/New/Text: 片段的文字。(記得在 `caption` 欄位中新增一個說明性的標題)。 +Strikethrough/Caption: 刪除線 +Strikethrough/Hint: 套用刪除線格式於所選文字 +Subscript/Caption: 下標 +Subscript/Hint: 套用下標格式於所選文字 +Superscript/Caption: 上標 +Superscript/Hint: 套用上標格式於所選文字 +Underline/Caption: 底線 +Underline/Hint: 套用底線格式於所選文字 +Undo/Caption: 還原 +Undo/Hint: 還原上一次的操作 diff --git a/languages/zh-Hant/ControlPanel.multids b/languages/zh-Hant/ControlPanel.multids index 34136fff3..2b7793635 100644 --- a/languages/zh-Hant/ControlPanel.multids +++ b/languages/zh-Hant/ControlPanel.multids @@ -27,6 +27,19 @@ EditorTypes/Hint: 這些條目決定使用哪個編輯器來編輯特定條目 EditorTypes/Type/Caption: 類型 Info/Caption: 資訊 Info/Hint: 有關此 TiddlyWiki 的資訊 +KeyboardShortcuts/Add/Prompt: 在此輸入快捷鍵 +KeyboardShortcuts/Add/Caption: 新增快捷鍵 +KeyboardShortcuts/Caption: 快捷鍵 +KeyboardShortcuts/Hint: 管理鍵盤快捷鍵分配 +KeyboardShortcuts/NoShortcuts/Caption: 尚無指定快捷鍵 +KeyboardShortcuts/Remove/Hint: 刪除快捷鍵 +KeyboardShortcuts/Platform/All: 所有平臺 +KeyboardShortcuts/Platform/Mac: 僅 Macintosh 平臺 +KeyboardShortcuts/Platform/NonMac: 僅非 Macintosh 平臺 +KeyboardShortcuts/Platform/Linux: 僅 Linux 平臺 +KeyboardShortcuts/Platform/NonLinux: 僅非 Linux 平臺 +KeyboardShortcuts/Platform/Windows: 僅 Windows 平臺 +KeyboardShortcuts/Platform/NonWindows: 僅非 Windows 平臺 LoadedModules/Caption: 已載入的模組 LoadedModules/Hint: 這些是當前已載入的模組之源碼條目。斜體的模組則無源碼條目,通常是因為它們是在引導過程中設置。 Palette/Caption: 調色盤 @@ -136,6 +149,8 @@ Toolbars/EditToolbar/Hint: 選擇將顯示哪些按鈕於條目的編輯模式 Toolbars/Hint: 選擇將顯示哪些工具列按鈕 Toolbars/PageControls/Caption: 頁面工具列 Toolbars/PageControls/Hint: 選擇將顯示哪些按鈕於主頁面的工具列 +Toolbars/EditorToolbar/Caption: 編輯器工具列 +Toolbars/EditorToolbar/Hint: 選擇將顯示哪些按鈕於編輯器工具列。請注意,某些按鈕只會出現在編輯某一類型的條目時。 Toolbars/ViewToolbar/Caption: 檢視工具列 Toolbars/ViewToolbar/Hint: 選擇將顯示哪些按鈕於條目的檢視模式工具列 Tools/Download/Full/Caption: 下載完整副本 diff --git a/languages/zh-Hant/EditTemplate.multids b/languages/zh-Hant/EditTemplate.multids index c56405ceb..0bfaecadf 100644 --- a/languages/zh-Hant/EditTemplate.multids +++ b/languages/zh-Hant/EditTemplate.multids @@ -1,11 +1,7 @@ title: $:/language/EditTemplate/ Body/External/Hint: 這是儲存於主要的 TiddlyWiki 檔之外的外部條目。你可以編輯其標籤和欄位,但不能直接編輯內容本身 -Body/Hint: 使用 WikiText 來新增格式、圖片及動態功能 Body/Placeholder: 輸入此條目的內容 -Body/Preview/Button/Hide: 隱藏預覽 -Body/Preview/Button/Show: 顯示預覽 -Body/Preview/Type: 預覽類型: Body/Preview/Type/Output: 輸出 Field/Remove/Caption: 刪除欄位 Field/Remove/Hint: 刪除欄位 diff --git a/languages/zh-Hant/GettingStarted.tid b/languages/zh-Hant/GettingStarted.tid index f50d20ff3..abd686f12 100644 --- a/languages/zh-Hant/GettingStarted.tid +++ b/languages/zh-Hant/GettingStarted.tid @@ -11,7 +11,7 @@ title: GettingStarted |<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> | |<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> | -|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit-text tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// | +|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// | </div> 請參閱[[控制台|$:/ControlPanel]]查看更多選項。 \ No newline at end of file diff --git a/languages/zh-Hant/Misc.multids b/languages/zh-Hant/Misc.multids index 4a8d92f13..4a7efc50d 100644 --- a/languages/zh-Hant/Misc.multids +++ b/languages/zh-Hant/Misc.multids @@ -5,6 +5,7 @@ BinaryWarning/Prompt: 此條目包含二進位資料 ClassicWarning/Hint: 此條目以經典版 TiddlyWiki 標記格式撰寫,不完全相容新版 TiddlyWiki 的格式,詳細資訊請參閱:http://tiddlywiki.com/static/Upgrading。 ClassicWarning/Upgrade/Caption: 升級 CloseAll/Button: 全部關閉 +ColourPicker/Recent: 最近︰ ConfirmCancelTiddler: 您確定要放棄對條目 "<$text text=<<title>>/>" 的更改? ConfirmDeleteTiddler: 您確定要刪除條目 "<$text text=<<title>>/>"? ConfirmOverwriteTiddler: 您確定要覆寫條目 "<$text text=<<title>>/>"? diff --git a/languages/zh-Hant/Snippets/ListByTag.tid b/languages/zh-Hant/Snippets/ListByTag.tid new file mode 100644 index 000000000..85b58f470 --- /dev/null +++ b/languages/zh-Hant/Snippets/ListByTag.tid @@ -0,0 +1,6 @@ +title: $:/language/Snippets/ListByTag +tags: $:/tags/TextEditor/Snippet +caption: 依標籤篩選的條目列表 +mode: wikified + +<<list-links "[tag[task]sort[title]]">> diff --git a/languages/zh-Hant/Snippets/MacroDefinition.tid b/languages/zh-Hant/Snippets/MacroDefinition.tid new file mode 100644 index 000000000..53c04dcf4 --- /dev/null +++ b/languages/zh-Hant/Snippets/MacroDefinition.tid @@ -0,0 +1,8 @@ +title: $:/language/Snippets/MacroDefinition +tags: $:/tags/TextEditor/Snippet +caption: 巨集的定義 +mode: wikified + +\define macroName(param1:"預設值",param2) +巨集的內容 +\end diff --git a/languages/zh-Hant/Snippets/Table 4x3.tid b/languages/zh-Hant/Snippets/Table 4x3.tid new file mode 100644 index 000000000..082e30957 --- /dev/null +++ b/languages/zh-Hant/Snippets/Table 4x3.tid @@ -0,0 +1,9 @@ +title: $:/language/Snippets/Table4x3 +tags: $:/tags/TextEditor/Snippet +caption: 4 x 3 的表格 +mode: wikified + +|! | !一 | !二 | !三 | !四 | +|! 1| | | | | +|! 2| | | | | +|! 3 | | | | | diff --git a/languages/zh-Hant/Snippets/TableOfContents.tid b/languages/zh-Hant/Snippets/TableOfContents.tid new file mode 100644 index 000000000..c735a9719 --- /dev/null +++ b/languages/zh-Hant/Snippets/TableOfContents.tid @@ -0,0 +1,10 @@ +title: $:/language/Snippets/TableOfContents +tags: $:/tags/TextEditor/Snippet +caption: 目錄 +mode: wikified + +<div class="tc-table-of-contents"> + +<<toc-selective-expandable 'TableOfContents'>> + +</div> \ No newline at end of file diff --git a/plugins/tiddlywiki/codemirror/EditorTypeMappings.multids b/plugins/tiddlywiki/codemirror/EditorTypeMappings.multids old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/edit-codemirror.js b/plugins/tiddlywiki/codemirror/edit-codemirror.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/addon/dialog/dialog.css b/plugins/tiddlywiki/codemirror/files/addon/dialog/dialog.css old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/addon/dialog/dialog.js b/plugins/tiddlywiki/codemirror/files/addon/dialog/dialog.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/addon/edit/matchbrackets.js b/plugins/tiddlywiki/codemirror/files/addon/edit/matchbrackets.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/addon/search/searchcursor.js b/plugins/tiddlywiki/codemirror/files/addon/search/searchcursor.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/codemirror.css b/plugins/tiddlywiki/codemirror/files/codemirror.css old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/codemirror.js b/plugins/tiddlywiki/codemirror/files/codemirror.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/keymap/emacs.js b/plugins/tiddlywiki/codemirror/files/keymap/emacs.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/keymap/extra.js b/plugins/tiddlywiki/codemirror/files/keymap/extra.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/keymap/sublime.js b/plugins/tiddlywiki/codemirror/files/keymap/sublime.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/keymap/vim.js b/plugins/tiddlywiki/codemirror/files/keymap/vim.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/mode/javascript/javascript.js b/plugins/tiddlywiki/codemirror/files/mode/javascript/javascript.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/files/tiddlywiki.files b/plugins/tiddlywiki/codemirror/files/tiddlywiki.files old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/plugin.info b/plugins/tiddlywiki/codemirror/plugin.info old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/readme.tid b/plugins/tiddlywiki/codemirror/readme.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/styles.tid b/plugins/tiddlywiki/codemirror/styles.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/codemirror/usage.tid b/plugins/tiddlywiki/codemirror/usage.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/internals/editpreviews/parse-tree.tid b/plugins/tiddlywiki/internals/editpreviews/parse-tree.tid index 5988b24ea..aafa30ecf 100644 --- a/plugins/tiddlywiki/internals/editpreviews/parse-tree.tid +++ b/plugins/tiddlywiki/internals/editpreviews/parse-tree.tid @@ -3,8 +3,14 @@ tags: $:/tags/EditPreview list-after: $:/core/ui/EditTemplate/body/preview/output caption: parse tree -\define preview(mode,output) -<$parse-tree mode="$mode$" output="$output$"/> +\define preview(mode) +<$wikify name="preview-text" text={{!!text}} type={{!!type}} mode="$mode$" output="parsetree"> +<pre> +<code> +<$text text=<<preview-text>>/> +</code> +</pre> +</$wikify> \end {{||$:/plugins/tiddlywiki/internals/EditTemplate/body/preview/shared}} diff --git a/plugins/tiddlywiki/internals/editpreviews/shared.tid b/plugins/tiddlywiki/internals/editpreviews/shared.tid index 41219cb9e..3f3eb6d48 100644 --- a/plugins/tiddlywiki/internals/editpreviews/shared.tid +++ b/plugins/tiddlywiki/internals/editpreviews/shared.tid @@ -7,7 +7,7 @@ Mode: <$select tiddler="$(tv-mode-configuration)$" default="block"> <option value="block">Block</option> </$select> -<$macrocall $name="preview" mode={{$(tv-mode-configuration)$}} output={{$(tv-output-configuration)$}}/> +<$macrocall $name="preview" mode={{$(tv-mode-configuration)$}}/> \end <div class="tc-internal-tree-preview-wrapper"> diff --git a/plugins/tiddlywiki/internals/editpreviews/widget-tree.tid b/plugins/tiddlywiki/internals/editpreviews/widget-tree.tid index 36a2b437c..457ca7e96 100644 --- a/plugins/tiddlywiki/internals/editpreviews/widget-tree.tid +++ b/plugins/tiddlywiki/internals/editpreviews/widget-tree.tid @@ -3,8 +3,14 @@ tags: $:/tags/EditPreview caption: widget tree list-after: $:/plugins/tiddlywiki/internals/EditTemplate/body/preview/parse-tree -\define preview(mode,output) -<$widget-tree mode="$mode$" output="$output$"/> +\define preview(mode) +<$wikify name="preview-text" text={{!!text}} type={{!!type}} mode="$mode$" output="widgettree"> +<pre> +<code> +<$text text=<<preview-text>>/> +</code> +</pre> +</$wikify> \end {{||$:/plugins/tiddlywiki/internals/EditTemplate/body/preview/shared}} diff --git a/plugins/tiddlywiki/internals/widgets/parse-tree.js b/plugins/tiddlywiki/internals/widgets/parse-tree.js deleted file mode 100644 index c2e1c780f..000000000 --- a/plugins/tiddlywiki/internals/widgets/parse-tree.js +++ /dev/null @@ -1,75 +0,0 @@ -/*\ -title: $:/$:/plugins/tiddlywiki/internals/widgets/parse-tree.js -type: application/javascript -module-type: widget - -Widget to render the parse tree of a tiddler - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -var Widget = require("$:/core/modules/widgets/widget.js").widget; - -var ParseTreeWidget = function(parseTreeNode,options) { - this.initialise(parseTreeNode,options); -}; - -/* -Inherit from the base widget class -*/ -ParseTreeWidget.prototype = new Widget(); - -/* -Render this widget into the DOM -*/ -ParseTreeWidget.prototype.render = function(parent,nextSibling) { - var self = this; - this.parentDomNode = parent; - this.computeAttributes(); - this.execute(); - this.renderChildren(parent,nextSibling); -}; - -/* -Compute the internal state of the widget -*/ -ParseTreeWidget.prototype.execute = function() { - // Get our parameters - this.parseTreeTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); - this.parseTreeInlineMode = this.getAttribute("mode","block") === "inline"; - // Compute the parse tree - var parser = this.wiki.parseTiddler(this.parseTreeTitle,{parseAsInline: this.parseTreeInlineMode}), - parseTreeNodes = []; - if(parser) { - parseTreeNodes = [{ - type: "codeblock", - attributes: { - code: {type: "string", value: JSON.stringify(parser.tree,0,$tw.config.preferences.jsonSpaces)}, - language: {type: "string", value: "json"} - } - }]; - } - // Make the child widgets - this.makeChildWidgets(parseTreeNodes); -}; - -/* -Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering -*/ -ParseTreeWidget.prototype.refresh = function(changedTiddlers) { - var changedAttributes = this.computeAttributes(); - // Completely rerender if any of our attributes have changed - if(changedAttributes.tiddler || changedAttributes.mode || changedTiddlers[this.parseTreeTitle]) { - this.refreshSelf(); - return true; - } - return false; -}; - -exports["parse-tree"] = ParseTreeWidget; - -})(); diff --git a/plugins/tiddlywiki/internals/widgets/widget-tree.js b/plugins/tiddlywiki/internals/widgets/widget-tree.js deleted file mode 100644 index bc812482f..000000000 --- a/plugins/tiddlywiki/internals/widgets/widget-tree.js +++ /dev/null @@ -1,107 +0,0 @@ -/*\ -title: $:/plugins/tiddlywiki/internals/widgets/widget-tree.js -type: application/javascript -module-type: widget - -Widget to render the widget tree of a tiddler - -\*/ -(function(){ - -/*jslint node: true, browser: true */ -/*global $tw: false */ -"use strict"; - -var Widget = require("$:/core/modules/widgets/widget.js").widget; - -var WidgetTreeWidget = function(parseTreeNode,options) { - this.initialise(parseTreeNode,options); -}; - -/* -Inherit from the base widget class -*/ -WidgetTreeWidget.prototype = new Widget(); - -/* -Render this widget into the DOM -*/ -WidgetTreeWidget.prototype.render = function(parent,nextSibling) { - var self = this; - this.parentDomNode = parent; - this.computeAttributes(); - this.execute(); - this.renderChildren(parent,nextSibling); -}; - -/* -Compute the internal state of the widget -*/ -WidgetTreeWidget.prototype.execute = function() { - // Get our parameters - this.widgetTreeTitle = this.getAttribute("tiddler",this.getVariable("currentTiddler")); - this.widgetTreeInlineMode = this.getAttribute("mode","block") === "inline"; - // Compute the widget tree - var parser = this.wiki.parseTiddler(this.widgetTreeTitle,{parseAsInline: this.widgetTreeInlineMode}), - results; - if(parser) { - var widgetNode = this.wiki.makeWidget(parser,{ - parentWidget: this - }), - container = $tw.fakeDocument.createElement("div"), - copyNode = function(widgetNode,resultNode) { - var type = widgetNode.parseTreeNode.type; - resultNode.type = type; - switch(type) { - case "element": - resultNode.tag = widgetNode.parseTreeNode.tag; - break; - case "text": - resultNode.text = widgetNode.parseTreeNode.text; - break; - } - if(Object.keys(widgetNode.attributes || {}).length > 0) { - resultNode.attributes = {}; - $tw.utils.each(widgetNode.attributes,function(attr,attrName) { - resultNode.attributes[attrName] = widgetNode.getAttribute(attrName); - }); - } - if(Object.keys(widgetNode.children || {}).length > 0) { - resultNode.children = []; - $tw.utils.each(widgetNode.children,function(widgetChildNode) { - var node = {}; - resultNode.children.push(node); - copyNode(widgetChildNode,node); - }); - } - }; - widgetNode.render(container,null); - results = {}; - copyNode(widgetNode,results); - } - // Make the child widgets - this.makeChildWidgets([{ - type: "codeblock", - attributes: { - code: {type: "string", value: (results && results.children) ? JSON.stringify(results.children,0,$tw.config.preferences.jsonSpaces) : ""}, - language: {type: "string", value: "json"} - } - }]); -}; - -/* -Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering -*/ -WidgetTreeWidget.prototype.refresh = function(changedTiddlers) { - var changedAttributes = this.computeAttributes(); - // Completely rerender if any of our attributes have changed - if(changedAttributes.tiddler || changedAttributes.mode || changedTiddlers[this.widgetTreeTitle]) { - this.refreshSelf(); - return true; - } - return false; -}; - -exports["widget-tree"] = WidgetTreeWidget; - -})(); diff --git a/plugins/tiddlywiki/markdown/dialect.tid b/plugins/tiddlywiki/markdown/dialect.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/docs_type_markdown.tid b/plugins/tiddlywiki/markdown/docs_type_markdown.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/files/markdown.js b/plugins/tiddlywiki/markdown/files/markdown.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/files/tiddlywiki.files b/plugins/tiddlywiki/markdown/files/tiddlywiki.files old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/plugin.info b/plugins/tiddlywiki/markdown/plugin.info old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/readme.tid b/plugins/tiddlywiki/markdown/readme.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/usage.tid b/plugins/tiddlywiki/markdown/usage.tid old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/markdown/wrapper.js b/plugins/tiddlywiki/markdown/wrapper.js old mode 100644 new mode 100755 diff --git a/plugins/tiddlywiki/translators/templates/snippet-tid.tid b/plugins/tiddlywiki/translators/templates/snippet-tid.tid new file mode 100644 index 000000000..6b3578a33 --- /dev/null +++ b/plugins/tiddlywiki/translators/templates/snippet-tid.tid @@ -0,0 +1,11 @@ +title: $:/plugins/tiddlywiki/translators/templates/snippet-tid + +\define generateTid(title) +title: $:/language/Snippets/$title$ +tags: $:/tags/TextEditor/Snippet +mode: wikified +caption: <$text text={{$:/language/Snippets/$title$!!caption}}/> + +<$text text={{$:/language/Snippets/$title$}}/> +\end +<$macrocall $name="generateTid" title=<<currentTiddler>>/> \ No newline at end of file diff --git a/plugins/tiddlywiki/translators/ui/editorTag.tid b/plugins/tiddlywiki/translators/ui/editorTag.tid index 81f163abc..02b3c8ce3 100644 --- a/plugins/tiddlywiki/translators/ui/editorTag.tid +++ b/plugins/tiddlywiki/translators/ui/editorTag.tid @@ -1,3 +1,3 @@ title: $:/plugins/tiddlywiki/translators/editorTag -input \ No newline at end of file +textarea \ No newline at end of file diff --git a/plugins/tiddlywiki/translators/ui/group/Snippets.tid b/plugins/tiddlywiki/translators/ui/group/Snippets.tid new file mode 100644 index 000000000..6880c58a1 --- /dev/null +++ b/plugins/tiddlywiki/translators/ui/group/Snippets.tid @@ -0,0 +1,16 @@ +title: $:/plugins/tiddlywiki/translators/ui/group/Snippets +caption: Snippets +tags: $:/tags/TranslationGroup + +\define translatableTiddlerTitles() +[all[tiddlers+shadows]prefix[$:/language/Snippets/]sort[title]] +\end +\define shortenTitle() +[all[current]removeprefix[$:/language/Snippets/]] +\end + +! Snippets + +Text snippets for use by the stamp text editor toolbar button. + +<<translatableStringEditor editorFields:"caption text">> diff --git a/themes/tiddlywiki/vanilla/ThemeTweaks.tid b/themes/tiddlywiki/vanilla/ThemeTweaks.tid index 360c4b978..e1e42d0ed 100644 --- a/themes/tiddlywiki/vanilla/ThemeTweaks.tid +++ b/themes/tiddlywiki/vanilla/ThemeTweaks.tid @@ -2,22 +2,23 @@ title: $:/themes/tiddlywiki/vanilla/themetweaks tags: $:/tags/ControlPanel/Appearance caption: Theme Tweaks +\define replacement-text() +[img[$(imageTitle)$]] +\end + \define backgroundimage-dropdown() <div class="tc-drop-down-wrapper"> <$button popup=<<qualify "$:/state/popup/themetweaks/backgroundimage">> class="tc-btn-invisible tc-btn-dropdown">{{$:/core/images/down-arrow}}</$button> <$reveal state=<<qualify "$:/state/popup/themetweaks/backgroundimage">> type="popup" position="belowleft" text="" default=""> <div class="tc-drop-down"> -<$linkcatcher to="$:/themes/tiddlywiki/vanilla/settings/backgroundimage"> -<$link to=""> -(none) -</$link> -<hr> -<$list filter="[all[shadows+tiddlers]is[image]] -[type[application/pdf]] +[sort[title]]"> -<$link to={{!!title}}> -<$transclude/> <$view field="title"/> -</$link> -</$list> -</$linkcatcher> +<$macrocall $name="image-picker" actions=""" + +<$action-setfield + $tiddler="$:/themes/tiddlywiki/vanilla/settings/backgroundimage" + $value=<<imageTitle>> +/> + +"""/> </div> </$reveal> </div> diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 324afee29..8107ecdbe 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -320,7 +320,7 @@ a.tc-tiddlylink-external:hover { ** Buttons */ -button svg, button img { +button svg, button img, label svg, label img { vertical-align: middle; } @@ -893,13 +893,18 @@ button.tc-untagged-label { color: <<colour very-muted-foreground>>; } -.tc-tiddler-frame input.tc-edit-texteditor, .tc-tiddler-frame textarea.tc-edit-texteditor { +.tc-tiddler-frame .tc-edit-texteditor { width: 100%; + margin: 4px 0 4px 0; +} + +.tc-tiddler-frame input.tc-edit-texteditor, +.tc-tiddler-frame textarea.tc-edit-texteditor, +.tc-tiddler-frame iframe.tc-edit-texteditor { padding: 3px 3px 3px 3px; border: 1px solid <<colour tiddler-editor-border>>; line-height: 1.3em; -webkit-appearance: none; - margin: 4px 0 4px 0; } .tc-tiddler-frame .tc-binary-warning { @@ -959,6 +964,53 @@ html body.tc-body.tc-single-tiddler-window { max-width: 100%; } +/* +** Editor +*/ + +.tc-editor-toolbar { + margin-top: 8px; +} + +.tc-editor-toolbar button { + vertical-align: middle; + background-color: <<colour tiddler-controls-foreground>>; + fill: <<colour tiddler-controls-foreground-selected>>; + border-radius: 4px; + padding: 3px; + margin: 2px 0; +} + +.tc-editor-toolbar button.tc-text-editor-toolbar-item-adjunct { + margin-left: -4px; + width: 1em; + border-radius: 8px; +} + +.tc-editor-toolbar button.tc-selected { + background-color: <<colour primary>>; +} + +.tc-editor-toolbar button svg { + width: 1.6em; + height: 1.2em; +} + +.tc-editor-toolbar button:hover { + background-color: <<colour tiddler-controls-foreground-selected>>; + fill: <<colour background>>; +} + +.tc-editor-toolbar .tc-text-editor-toolbar-more { + white-space: normal; +} + +.tc-editor-toolbar .tc-text-editor-toolbar-more button { + display: inline-block; + padding: 3px; + width: auto; +} + /* ** Adjustments for fluid-fixed mode */ @@ -1092,14 +1144,18 @@ html body.tc-body.tc-single-tiddler-window { .tc-tiddler-preview-preview { float: right; - width: 48%; + width: 49%; border: 1px solid <<colour tiddler-editor-border>>; margin: 4px 3px 3px 3px; padding: 3px 3px 3px 3px; } -.tc-tiddler-preview-edit { - width: 48%; +.tc-tiddler-frame .tc-tiddler-preview .tc-edit-texteditor { + width: 49%; +} + +.tc-tiddler-frame .tc-tiddler-preview canvas.tc-edit-bitmapeditor { + max-width: 49%; } .tc-edit-fields { @@ -1335,6 +1391,55 @@ html body.tc-body.tc-single-tiddler-window { padding: 0 7px 0 7px; } +.tc-image-chooser, .tc-colour-chooser { + white-space: normal; +} + +.tc-image-chooser a, +.tc-colour-chooser a { + display: inline-block; + vertical-align: top; + text-align: center; + position: relative; +} + +.tc-image-chooser a { + border: 1px solid <<colour muted-foreground>>; + padding: 2px; + margin: 2px; + width: 4em; + height: 4em; +} + +.tc-colour-chooser a { + padding: 3px; + width: 2em; + height: 2em; + vertical-align: middle; +} + +.tc-image-chooser a:hover, +.tc-colour-chooser a:hover { + background: <<colour primary>>; + padding: 0px; + border: 3px solid <<colour primary>>; +} + +.tc-image-chooser a svg, +.tc-image-chooser a img { + display: inline-block; + width: auto; + height: auto; + max-width: 3.5em; + max-height: 3.5em; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; +} + /* ** Modals */