diff --git a/CHANGELOG.md b/CHANGELOG.md index 91f25a7ee..e1dac91d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Update from Maintenance > Update as usual - this release has two database change - Admin > Settings > Security has a Passkeys switch, on. Off, passkeys already added are kept but don't sign anyone in until it's on again. - Resetting an agent's MFA (Admin > Users) or turning off a contact's two-step sign-in also removes their passkeys, for a lost or replaced device, and so do archiving an agent and resetting every agent's password. Agents and contacts are emailed when a passkey is added to or removed from their account, failed passkey sign-ins count towards the same lockout as passwords, and both show in the sign-in log. - Documents in Markdown: a document can be written in Markdown instead of the rich text editor - pick Markdown above the editor in New Document or Edit, write in the box, and Preview shows how it will look. Headings, lists, checklists, tables, code, quotes and links all work, and a picture pasted or dropped into the box is added to the document. Switching between Markdown and rich text converts what is already written, either way; switching to Markdown says when some formatting, such as colours or merged table cells, stays as HTML in it. New Document starts in whichever you used last. +- The Markdown box has a toolbar like the rich text editor's: headings, bold, italic, struck text, link, bulleted and numbered lists, checklist, quote, code, code block, table, line and picture - each on what's picked or where the cursor is, and off again when it's already there. Ctrl+B, Ctrl+I and Ctrl+K (a link) work too, and Enter in a list, checklist or quote starts the next item, or on an empty one ends the list. Changes can be undone with Ctrl+Z. The ? at its end shows the Markdown for each. - Markdown files: the menu beside Upload on a client's Files has Import Markdown Files, which makes a document from each .md file picked, named by the heading it starts with or its file name. A document's page has a Markdown button beside PDF, which downloads it as a .md file - rich text documents too. - Markdown pasted into a document's rich text editor - copied from GitHub, VS Code, Obsidian or an AI chat - goes in as formatting. Ctrl+Shift+V pastes it as it is. - A document's page is easier to read: headings in proportion to the text with room between sections, and tables, code and quotes that look part of it. Under its name are its folder, its template, Markdown when it's written in it, and its review - due, or when it's next due - whose menu has Mark Reviewed and how often. The buttons are Edit, Share and Export (PDF, Markdown or Print), with the rest in the ⋮ menu, now including Template. Beside it, Contents marks the section you're reading, and Linked, Versions and History are tabs of one card: Linked shows each kind of record with its count, opening to the list. @@ -36,6 +37,7 @@ Update from Maintenance > Update as usual - this release has two database change - functions/markdown.php: markdownToHtml() (league/commonmark 2.10 GitHubFlavoredMarkdownConverter, raw HTML allowed and then passed through documentHtmlPurify(), task boxes drawn as spans, tables given the app's table classes, all in div.itflow-markdown), htmlToMarkdown() (league/html-to-markdown 5.2 with tables; tables with merged cells and sized pictures kept as HTML), markdownSaveImages(), markdownImportSplit() (front matter title, leading heading) and documentMarkdownFile(). Both libraries and their dependencies (league/config, dflydev/dot-access-data, nette/schema, nette/utils, psr/event-dispatcher) are in libs/vendor through libs/composer.json. - agent/ajax.php markdown_to_html and html_to_markdown back js/document_markdown.js (loaded in includes/footer.php): the form's Rich text / Markdown switch, Write / Preview, pasted pictures held as pasted:N until Preview or Save, the remembered format for New Document, and the Markdown paste handler for .tinymce and .tinymce-page editors. New handlers export_document_markdown and import_markdown_documents in agent/post/document.php; versions, version restore, documentCopy() and the API's document create and update carry the Markdown (document_markdown in the API), and the API's create and update escape each value once. - The document page (agent/document.php): .itflow-prose in css/itflow_custom.css styles what it says; linkGroupsHtml() (functions/links.php) takes $compact - groups that open to their rows, open already with five links or fewer, no Link per group or empty groups - and $total; js/document_contents.js marks the section in view and opens a tab of the side card from a[data-document-tab]. +- The Markdown box's toolbar ([data-markdown-toolbar] in agent/modals/document/document_form.php, data-md on each button) and its keys are in js/document_markdown.js; edits go in with document.execCommand('insertText'), falling back to setRangeText(), so the browser's undo keeps them. ## [26.12.2] diff --git a/agent/modals/document/document_form.php b/agent/modals/document/document_form.php index aefbe9841..ecbfd2fb1 100644 --- a/agent/modals/document/document_form.php +++ b/agent/modals/document/document_form.php @@ -87,15 +87,44 @@ $document_format_uid = bin2hex(random_bytes(4));
# Heading ## Smaller | Headings | **bold** _italic_ ~~struck~~ | Text |