mirror of
https://github.com/docmost/docmost.git
synced 2025-11-19 08:21:09 +10:00
feat: edit mode preference (#666)
* lock/unlock pages * remove using isLocked column - add default page edit state preference * * Move state management to editors (avoids flickers on edit mode switch) * Rename variables * Add strings to translation file * Memoize components in page component * Fix title editor sending update request on editable state change * fixed errors merging main * Fix embed view in read-only mode * remove unused line * sync * fix responsiveness on mobile --------- Co-authored-by: Philipinho <16838612+Philipinho@users.noreply.github.com>
This commit is contained in:
@ -32,7 +32,7 @@ const schema = z.object({
|
||||
|
||||
export default function EmbedView(props: NodeViewProps) {
|
||||
const { t } = useTranslation();
|
||||
const { node, selected, updateAttributes } = props;
|
||||
const { node, selected, updateAttributes, editor } = props;
|
||||
const { src, provider } = node.attrs;
|
||||
|
||||
const embedUrl = useMemo(() => {
|
||||
@ -50,6 +50,10 @@ export default function EmbedView(props: NodeViewProps) {
|
||||
});
|
||||
|
||||
async function onSubmit(data: { url: string }) {
|
||||
if (!editor.isEditable) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (provider) {
|
||||
const embedProvider = getEmbedProviderById(provider);
|
||||
if (embedProvider.id === "iframe") {
|
||||
@ -85,7 +89,13 @@ export default function EmbedView(props: NodeViewProps) {
|
||||
</AspectRatio>
|
||||
</>
|
||||
) : (
|
||||
<Popover width={300} position="bottom" withArrow shadow="md">
|
||||
<Popover
|
||||
width={300}
|
||||
position="bottom"
|
||||
withArrow
|
||||
shadow="md"
|
||||
disabled={!editor.isEditable}
|
||||
>
|
||||
<Popover.Target>
|
||||
<Card
|
||||
radius="md"
|
||||
|
||||
Reference in New Issue
Block a user