fix(popup_editor): respect user's read-only choice (closes #7715)

This commit is contained in:
Elian Doran 2025-11-25 08:19:48 +02:00
parent 3afe6df9f2
commit 24361ccd97
No known key found for this signature in database
17 changed files with 241 additions and 119 deletions

View File

@ -15,6 +15,8 @@ import PromotedAttributes from "../PromotedAttributes";
import FloatingButtons from "../FloatingButtons";
import { DESKTOP_FLOATING_BUTTONS, MOBILE_FLOATING_BUTTONS, POPUP_HIDDEN_FLOATING_BUTTONS } from "../FloatingButtonsDefinitions";
import utils from "../../services/utils";
import tree from "../../services/tree";
import froca from "../../services/froca";
export default function PopupEditor() {
const [ shown, setShown ] = useState(false);
@ -28,9 +30,19 @@ export default function PopupEditor() {
useTriliumEvent("openInPopup", async ({ noteIdOrPath }) => {
const noteContext = new NoteContext("_popup-editor");
const resolvedNotePath = await tree.resolveNotePath(noteIdOrPath, noteContext.hoistedNoteId);
if (!resolvedNotePath) return;
const noteId = tree.getNoteIdAndParentIdFromUrl(resolvedNotePath);
if (!noteId.noteId) return;
const note = await froca.getNote(noteId.noteId);
if (!note) return;
const hasUserSetNoteReadOnly = note.hasLabel("readOnly");
await noteContext.setNote(noteIdOrPath, {
viewScope: {
readOnlyTemporarilyDisabled: true
// Override auto-readonly notes to be editable, but respect user's choice to have a read-only note.
readOnlyTemporarilyDisabled: !hasUserSetNoteReadOnly
}
});

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
<p>This is a clone of a note. Go to its <a href="../UI%20Elements/Quick%20edit.html">primary location</a>.</p>

View File

@ -0,0 +1,84 @@
<figure class="image image-style-align-right image_resized" style="width:53.13%;">
<img style="aspect-ratio:895/694;" src="Quick edit_image.png"
width="895" height="694">
</figure>
<p><em>Quick edit</em> provides an alternative to the standard tab-based navigation
and editing.</p>
<p>Instead of clicking on a note which switches the&nbsp;<a class="reference-link"
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>&nbsp;to the newly selected note,
or navigating between two different&nbsp;<a class="reference-link" href="#root/_help_3seOhtN8uLIY">Tabs</a>,
the <em>Quick edit</em> feature opens as a popup window that can be easily
dismissed.</p>
<p>This feature is also well integrated with&nbsp;<a class="reference-link"
href="#root/_help_GTwFsgaA0lCt">Collections</a>&nbsp;such as the calendar view,
which makes it easy to edit entries without having to go back and forth
between the child note and the calendar.</p>
<h2>Feature highlights</h2>
<ul>
<li data-list-item-id="e7518c6e639543e819dc69a61b7252458">All note types are supported, including&nbsp;<a class="reference-link"
href="#root/_help_GTwFsgaA0lCt">Collections</a>.</li>
<li data-list-item-id="e07d1c09e805da052d353cc5335568b15">Note that the&nbsp;<a class="reference-link" href="#root/_help_0ESUbbAxVnoK">Note List</a>&nbsp;will
not be displayed, except for notes of type&nbsp;<a class="reference-link"
href="#root/_help_GTwFsgaA0lCt">Collections</a>.</li>
<li data-list-item-id="ef512b68c0951ae19965019449fd534fd">For&nbsp;<a class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a>&nbsp;notes,
depending on user preference, both the floating and classic editors are
supported. See&nbsp;<a class="reference-link" href="#root/_help_nRhnJkTT8cPs">Formatting toolbar</a>.</li>
<li
data-list-item-id="e5ff2b9a03ae44e626678f4c75e5b0433">The title and the note and the icon are editable, just like a normal tab.</li>
<li
data-list-item-id="e133aaf441d86628debd83bf6600c912b">The&nbsp;<a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;are
also displayed.
<ul>
<li data-list-item-id="e828766d6d8fa4c20390a45fe7d7d0f4f">This integrates well with&nbsp;<a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>&nbsp;where
there are predefined attributes such as the <em>Start date</em> and <em>End date</em>,
allowing for easy editing.</li>
</ul>
</li>
</ul>
<h2>Accessing the quick edit</h2>
<ul>
<li data-list-item-id="e0d35f751805c8b376b866d0637528710">From the&nbsp;<a class="reference-link" href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>:
<ul>
<li data-list-item-id="e404e51f44947e114221aa5e2fa975b35">Right click on a note and select <em>Quick edit</em>.</li>
<li data-list-item-id="e2d1dcf10a0591303e35050ad076e195e">or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on a note.</li>
</ul>
</li>
<li data-list-item-id="eeb8fc7bd156734ee5419bcafa69aa198">On&nbsp;<a class="reference-link" href="#root/_help_hrZ1D00cLbal">Internal (reference) links</a>:
<ul>
<li data-list-item-id="e81f7dddc5e83f43a972f99690fe304da">Right click and select <em>Quick edit</em>.</li>
<li data-list-item-id="ec723cc5f364a0fb658c1e23692db6cdc">or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on the link.</li>
</ul>
</li>
<li data-list-item-id="e94fabbd406b6ed26de435e83eb8f70a9">On a&nbsp;<a class="reference-link" href="#root/_help_lgKX7r3aL30x">Note Tooltip</a>,
press the quick edit icon.</li>
<li data-list-item-id="ea70b7255363988467c64cc55820f5b63">In&nbsp;<a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>:
<ul>
<li data-list-item-id="e56233286c914fabc7595eee12297e703">For&nbsp;<a class="reference-link" href="#root/_help_xWbu3jpNWapp">Calendar</a>:
<ul>
<li data-list-item-id="e3d26da71006e651e927b49a30d81ec60">Clicking on an event will open that event for quick editing.</li>
<li data-list-item-id="e7909cf828b7b0a29714ff3d63122638e">If the calendar is for the&nbsp;<a class="reference-link" href="#root/_help_l0tKav7yLHGF">Day Notes</a>&nbsp;root,
clicking on the day number will open the popup for that day note.</li>
</ul>
</li>
<li data-list-item-id="e88455d70816f2ae7bf3d98b88840160a">For&nbsp;<a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map</a>:
<ul>
<li data-list-item-id="ecb3a9cf40136a5d8c5d4e77dceacfa8d">Clicking on a marker will open that marker, but only if the map is in
read-only mode.</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>Handling of read-only notes</h2>
<p>The Quick edit feature has a unique behavior for&nbsp;<a class="reference-link"
href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/BFs8mudNFgCS/_help_CoFPLs3dRlXc">Read-Only Notes</a>:</p>
<ul>
<li data-list-item-id="e510a64522b36499b2f24e89f094b38c4">If the note is read-only due to performance reasons (auto read-only),
then the note is made editable for quick editing.</li>
<li data-list-item-id="e1d4ab7a9cad3802d3210f6df2ca65fcb">If the note has been manually set to read-only, then the note is read-only
to prevent accidental change.
<ul>
<li data-list-item-id="e2706236c214a1240efa6e97aef52bdf5">In this case, the note can still be edited by on-screen instructions.</li>
</ul>
</li>
</ul>

View File

@ -1,69 +0,0 @@
<figure class="image image-style-align-right image_resized" style="width:53.13%;">
<img style="aspect-ratio:895/694;" src="Quick edit_image.png"
width="895" height="694">
</figure>
<p><em>Quick edit</em> provides an alternative to the standard tab-based navigation
and editing.</p>
<p>Instead of clicking on a note which switches the&nbsp;<a class="reference-link"
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>&nbsp;to the newly selected note,
or navigating between two different&nbsp;<a class="reference-link" href="#root/_help_3seOhtN8uLIY">Tabs</a>,
the <em>Quick edit</em> feature opens as a popup window that can be easily
dismissed.</p>
<p>This feature is also well integrated with&nbsp;<a class="reference-link"
href="#root/_help_GTwFsgaA0lCt">Collections</a>&nbsp;such as the calendar view,
which makes it easy to edit entries without having to go back and forth
between the child note and the calendar.</p>
<h2>Feature highlights</h2>
<ul>
<li>All note types are supported, including&nbsp;<a class="reference-link"
href="#root/_help_GTwFsgaA0lCt">Collections</a>.</li>
<li>Note that the&nbsp;<a class="reference-link" href="#root/_help_0ESUbbAxVnoK">Note List</a>&nbsp;will
not be displayed, except for notes of type&nbsp;<a class="reference-link"
href="#root/_help_GTwFsgaA0lCt">Collections</a>.</li>
<li>For&nbsp;<a class="reference-link" href="#root/_help_iPIMuisry3hd">Text</a>&nbsp;notes,
depending on user preference, both the floating and classic editors are
supported. See&nbsp;<a class="reference-link" href="#root/_help_nRhnJkTT8cPs">Formatting toolbar</a>.</li>
<li>The title and the note and the icon are editable, just like a normal tab.</li>
<li>The&nbsp;<a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;are
also displayed.
<ul>
<li>This integrates well with&nbsp;<a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>&nbsp;where
there are predefined attributes such as the <em>Start date</em> and <em>End date</em>,
allowing for easy editing.</li>
</ul>
</li>
</ul>
<h2>Accessing the quick edit</h2>
<ul>
<li>From the&nbsp;<a class="reference-link" href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>:
<ul>
<li>Right click on a note and select <em>Quick edit</em>.</li>
<li>or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on a note.</li>
</ul>
</li>
<li>On&nbsp;<a class="reference-link" href="#root/_help_hrZ1D00cLbal">Internal (reference) links</a>:
<ul>
<li>Right click and select <em>Quick edit</em>.</li>
<li>or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on the link.</li>
</ul>
</li>
<li>On a&nbsp;<a class="reference-link" href="#root/_help_lgKX7r3aL30x">Note Tooltip</a>,
press the quick edit icon.</li>
<li>In&nbsp;<a class="reference-link" href="#root/_help_GTwFsgaA0lCt">Collections</a>:
<ul>
<li>For&nbsp;<a class="reference-link" href="#root/_help_xWbu3jpNWapp">Calendar View</a>:
<ul>
<li>Clicking on an event will open that event for quick editing.</li>
<li>If the calendar is for the&nbsp;<a class="reference-link" href="#root/_help_l0tKav7yLHGF">Day Notes</a>&nbsp;root,
clicking on the day number will open the popup for that day note.</li>
</ul>
</li>
<li>For&nbsp;<a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map View</a>:
<ul>
<li>Clicking on a marker will open that marker, but only if the map is in
read-only mode.</li>
</ul>
</li>
</ul>
</li>
</ul>

View File

@ -1,5 +1,5 @@
# Documentation
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/X0cCo0YF7qZj/Documentation_image.png" width="205" height="162">
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/y4NVNSy5SB5V/Documentation_image.png" width="205" height="162">
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.

View File

@ -3330,35 +3330,6 @@
"dataFileName": "Zoom.md",
"attachments": []
},
{
"isClone": false,
"noteId": "ZjLYv08Rp3qC",
"notePath": [
"pOsGYCXsbNQG",
"gh7bpGYxajRS",
"Vc8PjrjAGuOp",
"ZjLYv08Rp3qC"
],
"title": "Quick edit",
"notePosition": 200,
"prefix": null,
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [],
"format": "markdown",
"dataFileName": "Quick edit.md",
"attachments": [
{
"attachmentId": "EBOLwVGrA8bv",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Quick edit_image.png"
}
]
},
{
"isClone": false,
"noteId": "lgKX7r3aL30x",
@ -4886,7 +4857,7 @@
]
},
{
"isClone": true,
"isClone": false,
"noteId": "ZjLYv08Rp3qC",
"notePath": [
"pOsGYCXsbNQG",
@ -4895,11 +4866,130 @@
"ZjLYv08Rp3qC"
],
"title": "Quick edit",
"notePosition": 90,
"prefix": null,
"dataFileName": "Quick edit.clone.md",
"isExpanded": false,
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "label",
"name": "iconClass",
"value": "bx bx-edit",
"isInheritable": false,
"position": 30
},
{
"type": "label",
"name": "shareAlias",
"value": "quick-edit",
"isInheritable": false,
"position": 40
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 50
},
{
"type": "relation",
"name": "internalLink",
"value": "3seOhtN8uLIY",
"isInheritable": false,
"position": 60
},
{
"type": "relation",
"name": "internalLink",
"value": "GTwFsgaA0lCt",
"isInheritable": false,
"position": 70
},
{
"type": "relation",
"name": "internalLink",
"value": "0ESUbbAxVnoK",
"isInheritable": false,
"position": 80
},
{
"type": "relation",
"name": "internalLink",
"value": "iPIMuisry3hd",
"isInheritable": false,
"position": 90
},
{
"type": "relation",
"name": "internalLink",
"value": "nRhnJkTT8cPs",
"isInheritable": false,
"position": 100
},
{
"type": "relation",
"name": "internalLink",
"value": "OFXdgB2nNk1F",
"isInheritable": false,
"position": 110
},
{
"type": "relation",
"name": "internalLink",
"value": "hrZ1D00cLbal",
"isInheritable": false,
"position": 120
},
{
"type": "relation",
"name": "internalLink",
"value": "lgKX7r3aL30x",
"isInheritable": false,
"position": 130
},
{
"type": "relation",
"name": "internalLink",
"value": "xWbu3jpNWapp",
"isInheritable": false,
"position": 140
},
{
"type": "relation",
"name": "internalLink",
"value": "l0tKav7yLHGF",
"isInheritable": false,
"position": 150
},
{
"type": "relation",
"name": "internalLink",
"value": "81SGnPGMk7Xc",
"isInheritable": false,
"position": 160
},
{
"type": "relation",
"name": "internalLink",
"value": "CoFPLs3dRlXc",
"isInheritable": false,
"position": 170
}
],
"format": "markdown",
"isExpanded": false
"dataFileName": "Quick edit.md",
"attachments": [
{
"attachmentId": "EBOLwVGrA8bv",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Quick edit_image.png"
}
]
},
{
"isClone": false,

View File

@ -1,2 +0,0 @@
# Quick edit
This is a clone of a note. Go to its [primary location](../UI%20Elements/Quick%20edit.md).

View File

@ -3,7 +3,7 @@
_Quick edit_ provides an alternative to the standard tab-based navigation and editing.
Instead of clicking on a note which switches the <a class="reference-link" href="Note%20Tree.md">Note Tree</a> to the newly selected note, or navigating between two different <a class="reference-link" href="Tabs.md">Tabs</a>, the _Quick edit_ feature opens as a popup window that can be easily dismissed.
Instead of clicking on a note which switches the <a class="reference-link" href="../UI%20Elements/Note%20Tree.md">Note Tree</a> to the newly selected note, or navigating between two different <a class="reference-link" href="../UI%20Elements/Tabs.md">Tabs</a>, the _Quick edit_ feature opens as a popup window that can be easily dismissed.
This feature is also well integrated with <a class="reference-link" href="../../Collections.md">Collections</a> such as the calendar view, which makes it easy to edit entries without having to go back and forth between the child note and the calendar.
@ -18,16 +18,24 @@ This feature is also well integrated with <a class="reference-link" href="../..
## Accessing the quick edit
* From the <a class="reference-link" href="Note%20Tree.md">Note Tree</a>:
* From the <a class="reference-link" href="../UI%20Elements/Note%20Tree.md">Note Tree</a>:
* Right click on a note and select _Quick edit_.
* or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on a note.
* On <a class="reference-link" href="../../Note%20Types/Text/Links/Internal%20(reference)%20links.md">Internal (reference) links</a>:
* Right click and select _Quick edit_.
* or, press <kbd>Ctrl</kbd>+<kbd>Right click</kbd> on the link.
* On a <a class="reference-link" href="Note%20Tooltip.md">Note Tooltip</a>, press the quick edit icon.
* On a <a class="reference-link" href="../UI%20Elements/Note%20Tooltip.md">Note Tooltip</a>, press the quick edit icon.
* In <a class="reference-link" href="../../Collections.md">Collections</a>:
* For <a class="reference-link" href="../../Collections/Calendar.md">Calendar View</a>:
* For <a class="reference-link" href="../../Collections/Calendar.md">Calendar</a>:
* Clicking on an event will open that event for quick editing.
* If the calendar is for the <a class="reference-link" href="../../Advanced%20Usage/Advanced%20Showcases/Day%20Notes.md">Day Notes</a> root, clicking on the day number will open the popup for that day note.
* For <a class="reference-link" href="../../Collections/Geo%20Map.md">Geo Map View</a>:
* For <a class="reference-link" href="../../Collections/Geo%20Map.md">Geo Map</a>:
* Clicking on a marker will open that marker, but only if the map is in read-only mode.
## Handling of read-only notes
The Quick edit feature has a unique behavior for <a class="reference-link" href="../Notes/Read-Only%20Notes.md">Read-Only Notes</a>:
* If the note is read-only due to performance reasons (auto read-only), then the note is made editable for quick editing.
* If the note has been manually set to read-only, then the note is read-only to prevent accidental change.
* In this case, the note can still be edited by on-screen instructions.

View File

@ -10,7 +10,7 @@ The following information is displayed:
* Clicking on the title will open the note in the current tab.
* Holding <kbd>Ctrl</kbd> pressed while clicking the title will open in a new tab instead of the current one.
* A snippet of the content will be displayed as well.
* A button to [quickly edit](Quick%20edit.md) the note in a popup.
* A button to [quickly edit](../Navigation/Quick%20edit.md) the note in a popup.
The tooltip can be found in multiple places, including:

View File

@ -4,7 +4,7 @@ The <a class="reference-link" href="../Note%20Tree.md">Note Tree</a> comes wit
* Opening notes:
* <kbd>Click</kbd> to open the note in the current tab.
* <kbd>Ctrl</kbd>+<kbd>Click</kbd> or <kbd>Middle click</kbd> to open the note in a new tab.
* <kbd>Ctrl</kbd>+<kbd>Right click</kbd> to open the note in <a class="reference-link" href="../Quick%20edit.md">Quick edit</a>.
* <kbd>Ctrl</kbd>+<kbd>Right click</kbd> to open the note in <a class="reference-link" href="../../Navigation/Quick%20edit.md">Quick edit</a>.
* Navigation within the tree:
* <kbd>Up</kbd> and <kbd>Down</kbd> to navigate between notes.
* <kbd>Left</kbd> to collapse a note, or <kbd>Right</kbd> to expand it.

View File

@ -31,7 +31,7 @@ Unlike other Collection view types, the Calendar view also allows some kind of i
* Hovering the mouse over an event will display information about the note.
![](7_Calendar_image.png)
* Left clicking the event will open a <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Quick%20edit.md">Quick edit</a> to edit the note in a popup while allowing easy return to the calendar by just dismissing the popup.
* Left clicking the event will open a <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Navigation/Quick%20edit.md">Quick edit</a> to edit the note in a popup while allowing easy return to the calendar by just dismissing the popup.
* Middle clicking will open the note in a new tab.
* Right click will offer more options including opening the note in a new split or window.
* Drag and drop an event on the calendar to move it to another day.

View File

@ -75,7 +75,7 @@ If moved by mistake, there is currently no way to undo the change. If the mouse
* Clicking on the note title in the tooltip will navigate to the note in the current view.
* Middle-clicking the marker will open the note in a new tab.
* Right-clicking the marker will open a contextual menu (as described below).
* If the map is in read-only mode, clicking on a marker will open a <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Quick%20edit.md">Quick edit</a> popup for the corresponding note.
* If the map is in read-only mode, clicking on a marker will open a <a class="reference-link" href="../Basic%20Concepts%20and%20Features/Navigation/Quick%20edit.md">Quick edit</a> popup for the corresponding note.
## Contextual menu

View File

@ -4,7 +4,7 @@ This section presents the most important changes by version. For a full set of c
* v0.97.0:
* Books are now <a class="reference-link" href="Collections.md">Collections</a>.
* <a class="reference-link" href="Collections/Table.md">Table View</a> is a new collection type displaying notes and attributes in an editable grid.
* <a class="reference-link" href="Basic%20Concepts%20and%20Features/UI%20Elements/Quick%20edit.md">Quick edit</a> is introduced, adding a new way to edit notes in a popup instead of opening a new tab. It also integrates well with <a class="reference-link" href="Collections.md">Collections</a>.
* <a class="reference-link" href="Basic%20Concepts%20and%20Features/Navigation/Quick%20edit.md">Quick edit</a> is introduced, adding a new way to edit notes in a popup instead of opening a new tab. It also integrates well with <a class="reference-link" href="Collections.md">Collections</a>.
* v0.96.0:
* <a class="reference-link" href="Note%20Types/Text.md">Text</a> gain premium features thanks to a collaboration with the CKEditor team:
* <a class="reference-link" href="Note%20Types/Text/Premium%20features/Slash%20Commands.md">Slash Commands</a>