A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: resize only from bottom right corner
ammarahm-ed243c4656480b
diff --git a/packages/editor/dist/es/extensions/embed/component.js b/packages/editor/dist/es/extensions/embed/component.jsindex b2fa63701..8e3045d60 100644--- a/packages/editor/dist/es/extensions/embed/component.js+++ b/packages/editor/dist/es/extensions/embed/component.js@@ -4,29 +4,39 @@ import { Resizable } from "re-resizable";import { useRef } from "react";import { DesktopOnly } from "../../components/responsive";import { ToolbarGroup } from "../../toolbar/components/toolbar-group";+import { Icon, Icons } from "../../toolbar";export function EmbedComponent(props) {const { editor, updateAttributes, selected, node } = props;const embedRef = useRef();const { src, width, height, align } = node.attrs;return (_jsx(_Fragment, { children: _jsx(Box, Object.assign({ sx: {display: "flex",- justifyContent: align === "center" ? "center" : align === "left" ? "start" : "end",+ justifyContent: align === "center" ? "center" : align === "left" ? "start" : "end"} }, { children: _jsxs(Resizable, Object.assign({ enable: {- bottom: editor.isEditable,- left: editor.isEditable,- right: editor.isEditable,- top: editor.isEditable,- bottomLeft: editor.isEditable,- bottomRight: editor.isEditable,- topLeft: editor.isEditable,- topRight: editor.isEditable,+ bottom: false,+ left: false,+ right: false,+ top: false,+ bottomLeft: false,+ bottomRight: editor.isEditable && selected,+ topLeft: false,+ topRight: false}, size: {height: height || "auto",- width: width || "auto",- }, maxWidth: "100%", onResizeStop: (e, direction, ref, d) => {+ width: width || "auto"+ }, maxWidth: "100%", handleComponent: {+ bottomRight: (_jsx(Icon, { sx: {+ width: 25,+ height: 25,+ marginLeft: -17,+ marginTop: "3px",+ borderTopLeftRadius: "default",+ borderBottomRightRadius: "default"+ }, path: Icons.resize, size: 25, color: "primary" }))+ }, onResizeStop: (e, direction, ref, d) => {updateAttributes({width: ref.clientWidth,- height: ref.clientHeight,+ height: ref.clientHeight}, { addToHistory: true, preventUpdate: false });}, lockAspectRatio: true }, { children: [_jsx(Flex, Object.assign({ width: "100%", sx: {position: "relative",@@ -39,26 +49,26 @@ export function EmbedComponent(props) {borderColor: selected ? "border" : "bgSecondary",cursor: "pointer",":hover": {- borderColor: "border",- },+ borderColor: "border"+ }} }, { children: _jsx(DesktopOnly, { children: selected && (_jsx(Flex, Object.assign({ sx: { position: "relative", justifyContent: "end" } }, { children: _jsx(Flex, Object.assign({ sx: {position: "absolute",top: -40,mb: 2,- alignItems: "end",+ alignItems: "end"} }, { children: _jsx(ToolbarGroup, { editor: editor, tools: ["embedAlignLeft","embedAlignCenter","embedAlignRight",- "embedProperties",+ "embedProperties"], sx: {boxShadow: "menu",borderRadius: "default",- bg: "background",+ bg: "background"} }) })) }))) }) })), _jsx(Box, Object.assign({ as: "iframe", ref: embedRef, src: src, width: "100%", height: "100%", sx: {border: selected? "2px solid var(--primary)": "2px solid transparent",- borderRadius: "default",+ borderRadius: "default"} }, props))] })) })) }));}diff --git a/packages/editor/dist/es/toolbar/components/icon.js b/packages/editor/dist/es/toolbar/components/icon.jsindex 3f9d82bdb..64c7f6e38 100644--- a/packages/editor/dist/es/toolbar/components/icon.js+++ b/packages/editor/dist/es/toolbar/components/icon.js@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";import MDIIcon from "@mdi/react";import { Flex } from "rebass";import { useTheme } from "../stores/toolbar-store";-function MDIIconWrapper({ title, path, size = 24, color = "icon", stroke, rotate, }) {+function MDIIconWrapper({ title, path, size = 24, color = "icon", stroke, rotate }) {const theme = useTheme();const themedColor = (theme === null || theme === void 0 ? void 0 : theme.colors)? theme.colors[color]@@ -22,7 +22,7 @@ function MDIIconWrapper({ title, path, size = 24, color = "icon", stroke, rotate? `${(theme === null || theme === void 0 ? void 0 : theme.iconSizes[size]) || 24}px`: `${size}px`, style: {strokeWidth: stroke || "0px",- stroke: themedColor,+ stroke: themedColor}, color: themedColor, spin: rotate }));}export function Icon(props) {diff --git a/packages/editor/dist/es/toolbar/components/toolbutton.d.ts b/packages/editor/dist/es/toolbar/components/toolbutton.d.tsindex d7cb97dd4..c5b117976 100644--- a/packages/editor/dist/es/toolbar/components/toolbutton.d.ts+++ b/packages/editor/dist/es/toolbar/components/toolbutton.d.ts@@ -14,8 +14,8 @@ export declare type ToolButtonProps = ButtonProps & {};export declare const ToolButton: React.NamedExoticComponent<ButtonProps & {icon: IconNames;- iconColor?: "background" | "border" | "text" | "blue" | "gray" | "green" | "orange" | "purple" | "red" | "yellow" | "checked" | "disabled" | "placeholder" | "icon" | keyof import("@notesnook/theme/dist/theme/colorscheme/static").StaticColors | "primary" | "bgTransparent" | "accent" | "bgSecondary" | "bgSecondaryText" | "bgSecondaryHover" | "hover" | "fontSecondary" | "fontTertiary" | "overlay" | "secondary" | undefined;- iconSize?: number | "big" | "small" | "medium" | undefined;+ iconColor?: "background" | "border" | "text" | "blue" | "gray" | "green" | "orange" | "purple" | "red" | "yellow" | "checked" | "disabled" | "placeholder" | "icon" | "overlay" | "hover" | keyof import("@notesnook/theme/dist/theme/colorscheme/static").StaticColors | "primary" | "bgTransparent" | "accent" | "bgSecondary" | "bgSecondaryText" | "bgSecondaryHover" | "fontSecondary" | "fontTertiary" | "secondary" | undefined;+ iconSize?: number | "small" | "big" | "medium" | undefined;toggled: boolean;buttonRef?: React.MutableRefObject<HTMLButtonElement | null | undefined> | undefined;variant?: ToolButtonVariant | undefined;diff --git a/packages/editor/dist/es/toolbar/icons.d.ts b/packages/editor/dist/es/toolbar/icons.d.tsindex 4105cd1e7..9a38e6591 100644--- a/packages/editor/dist/es/toolbar/icons.d.ts+++ b/packages/editor/dist/es/toolbar/icons.d.ts@@ -93,6 +93,7 @@ export declare const Icons: {chevronLeft: string;circle: string;arrowLeft: string;+ resize: string;none: string;};export declare type IconNames = keyof typeof Icons;diff --git a/packages/editor/dist/es/toolbar/icons.js b/packages/editor/dist/es/toolbar/icons.jsindex 4c70bbce0..0c47cc30b 100644--- a/packages/editor/dist/es/toolbar/icons.js+++ b/packages/editor/dist/es/toolbar/icons.js@@ -1,4 +1,4 @@-import { mdiAttachment, mdiBorderHorizontal, mdiCheck, mdiChevronDown, mdiCodeBraces, mdiCodeTags, mdiDotsVertical, mdiFormatAlignCenter, mdiFormatAlignJustify, mdiFormatAlignLeft, mdiFormatAlignRight, mdiFormatBold, mdiFormatClear, mdiFormatColorHighlight, mdiFormatColorText, mdiFormatItalic, mdiFormatListBulleted, mdiFormatListNumbered, mdiFormatQuoteClose, mdiFormatStrikethrough, mdiFormatSubscript, mdiFormatSuperscript, mdiFormatTextdirectionLToR, mdiFormatTextdirectionRToL, mdiFormatUnderline, mdiImage, mdiInvertColorsOff, mdiLinkPlus, mdiLoading, mdiTable, mdiTableBorder, mdiTableRowPlusAfter, mdiTableRowPlusBefore, mdiTableRowRemove, mdiTableColumnPlusAfter, mdiTableColumnPlusBefore, mdiTableColumnRemove, mdiUploadOutline, mdiPlus, mdiFormatColorFill, mdiClose, mdiSortDescending, mdiArrowExpandRight, mdiArrowExpandLeft, mdiArrowExpandDown, mdiArrowExpandUp, mdiTableMergeCells, mdiTableSplitCell, mdiDeleteOutline, mdiDownloadOutline, mdiFormatListCheckbox, mdiDrag, mdiCheckboxMarkedOutline, mdiChevronUp, mdiArrowUp, mdiArrowDown, mdiRegex, mdiFormatLetterCase, mdiFormatLetterMatches, mdiMoviePlusOutline, mdiLink, mdiChevronRight, mdiTableColumnWidth, mdiTableRowHeight, mdiMinus, mdiPaletteOutline, mdiCircle, mdiChevronLeft, mdiTableCog, mdiTableOff, mdiRectangle, mdiImageEditOutline, mdiArrowLeft, mdiMovieCogOutline, mdiLinkOff, mdiOpenInNew, mdiCameraOutline, mdiMathIntegral, mdiFunctionVariant, mdiFileTreeOutline, mdiFormatFont, mdiFormatFontSizeIncrease, mdiFormatHeaderPound, mdiFormatIndentIncrease, mdiFormatIndentDecrease, } from "@mdi/js";+import { mdiAttachment, mdiBorderHorizontal, mdiCheck, mdiChevronDown, mdiCodeBraces, mdiCodeTags, mdiDotsVertical, mdiFormatAlignCenter, mdiFormatAlignJustify, mdiFormatAlignLeft, mdiFormatAlignRight, mdiFormatBold, mdiFormatClear, mdiFormatColorHighlight, mdiFormatColorText, mdiFormatItalic, mdiFormatListBulleted, mdiFormatListNumbered, mdiFormatQuoteClose, mdiFormatStrikethrough, mdiFormatSubscript, mdiFormatSuperscript, mdiFormatTextdirectionLToR, mdiFormatTextdirectionRToL, mdiFormatUnderline, mdiImage, mdiInvertColorsOff, mdiLinkPlus, mdiLoading, mdiTable, mdiTableBorder, mdiTableRowPlusAfter, mdiTableRowPlusBefore, mdiTableRowRemove, mdiTableColumnPlusAfter, mdiTableColumnPlusBefore, mdiTableColumnRemove, mdiUploadOutline, mdiPlus, mdiFormatColorFill, mdiClose, mdiSortDescending, mdiArrowExpandRight, mdiArrowExpandLeft, mdiArrowExpandDown, mdiArrowExpandUp, mdiTableMergeCells, mdiTableSplitCell, mdiDeleteOutline, mdiDownloadOutline, mdiFormatListCheckbox, mdiDrag, mdiCheckboxMarkedOutline, mdiChevronUp, mdiArrowUp, mdiArrowDown, mdiRegex, mdiFormatLetterCase, mdiFormatLetterMatches, mdiMoviePlusOutline, mdiLink, mdiChevronRight, mdiTableColumnWidth, mdiTableRowHeight, mdiMinus, mdiPaletteOutline, mdiCircle, mdiChevronLeft, mdiTableCog, mdiTableOff, mdiRectangle, mdiImageEditOutline, mdiArrowLeft, mdiMovieCogOutline, mdiLinkOff, mdiOpenInNew, mdiCameraOutline, mdiMathIntegral, mdiFunctionVariant, mdiFileTreeOutline, mdiFormatFont, mdiFormatFontSizeIncrease, mdiFormatHeaderPound, mdiFormatIndentIncrease, mdiFormatIndentDecrease, mdiResizeBottomRight } from "@mdi/js";export const Icons = {bold: mdiFormatBold,italic: mdiFormatItalic,@@ -94,5 +94,6 @@ export const Icons = {chevronLeft: mdiChevronLeft,circle: mdiCircle,arrowLeft: mdiArrowLeft,- none: "",+ resize: mdiResizeBottomRight,+ none: ""};diff --git a/packages/editor/src/extensions/embed/component.tsx b/packages/editor/src/extensions/embed/component.tsxindex 044a9fd0a..592d5b7ef 100644--- a/packages/editor/src/extensions/embed/component.tsx+++ b/packages/editor/src/extensions/embed/component.tsx@@ -5,6 +5,7 @@ import { EmbedAlignmentOptions, EmbedAttributes } from "./embed";import { SelectionBasedReactNodeViewProps } from "../react";import { DesktopOnly } from "../../components/responsive";import { ToolbarGroup } from "../../toolbar/components/toolbar-group";+import { Icon, Icons } from "../../toolbar";export function EmbedComponent(props: SelectionBasedReactNodeViewProps<@@ -21,30 +22,47 @@ export function EmbedComponent(sx={{display: "flex",justifyContent:- align === "center" ? "center" : align === "left" ? "start" : "end",+ align === "center" ? "center" : align === "left" ? "start" : "end"}}><Resizableenable={{- bottom: editor.isEditable,- left: editor.isEditable,- right: editor.isEditable,- top: editor.isEditable,- bottomLeft: editor.isEditable,- bottomRight: editor.isEditable,- topLeft: editor.isEditable,- topRight: editor.isEditable,+ bottom: false,+ left: false,+ right: false,+ top: false,+ bottomLeft: false,+ bottomRight: editor.isEditable && selected,+ topLeft: false,+ topRight: false}}size={{height: height || "auto",- width: width || "auto",+ width: width || "auto"}}maxWidth="100%"+ handleComponent={{+ bottomRight: (+ <Icon+ sx={{+ width: 25,+ height: 25,+ marginLeft: -17,+ marginTop: "3px",+ borderTopLeftRadius: "default",+ borderBottomRightRadius: "default"+ }}+ path={Icons.resize}+ size={25}+ color="primary"+ />+ )+ }}onResizeStop={(e, direction, ref, d) => {updateAttributes({width: ref.clientWidth,- height: ref.clientHeight,+ height: ref.clientHeight},{ addToHistory: true, preventUpdate: false });@@ -67,8 +85,8 @@ export function EmbedComponent(borderColor: selected ? "border" : "bgSecondary",cursor: "pointer",":hover": {- borderColor: "border",- },+ borderColor: "border"+ }}}><DesktopOnly>@@ -79,7 +97,7 @@ export function EmbedComponent(position: "absolute",top: -40,mb: 2,- alignItems: "end",+ alignItems: "end"}}><ToolbarGroup@@ -88,12 +106,12 @@ export function EmbedComponent("embedAlignLeft","embedAlignCenter","embedAlignRight",- "embedProperties",+ "embedProperties"]}sx={{boxShadow: "menu",borderRadius: "default",- bg: "background",+ bg: "background"}}/></Flex>@@ -111,7 +129,7 @@ export function EmbedComponent(border: selected? "2px solid var(--primary)": "2px solid transparent",- borderRadius: "default",+ borderRadius: "default"}}{...props}/>diff --git a/packages/editor/src/styles.css b/packages/editor/src/styles.cssindex 52446af8f..f4d69ae58 100644--- a/packages/editor/src/styles.css+++ b/packages/editor/src/styles.css@@ -10,6 +10,16 @@background-color: var(--bgSecondary);}+.ProseMirror:first-child {+ margin-top: 10px;+}++.ProseMirror hr {+ background-color: var(--border);+ border-width: 0;+ height: 2px;+}+.ProseMirror code:not(pre code) {background-color: var(--bgSecondary);border: 1px solid var(--border);diff --git a/packages/editor/src/toolbar/components/icon.tsx b/packages/editor/src/toolbar/components/icon.tsxindex d81213f55..23ef462d5 100644--- a/packages/editor/src/toolbar/components/icon.tsx+++ b/packages/editor/src/toolbar/components/icon.tsx@@ -18,7 +18,7 @@ function MDIIconWrapper({size = 24,color = "icon",stroke,- rotate,+ rotate}: IconProps) {const theme = useTheme();@@ -38,7 +38,7 @@ function MDIIconWrapper({}style={{strokeWidth: stroke || "0px",- stroke: themedColor,+ stroke: themedColor}}color={themedColor}spin={rotate}@@ -57,7 +57,7 @@ export function Icon(props: NNIconProps) {flexShrink: 0,justifyContent: "center",alignItems: "center",- ...sx,+ ...sx}}{...restProps}>diff --git a/packages/editor/src/toolbar/icons.ts b/packages/editor/src/toolbar/icons.tsindex 00cdb8128..f4d74f786 100644--- a/packages/editor/src/toolbar/icons.ts+++ b/packages/editor/src/toolbar/icons.ts@@ -84,6 +84,7 @@ import {mdiFormatHeaderPound,mdiFormatIndentIncrease,mdiFormatIndentDecrease,+ mdiResizeBottomRight} from "@mdi/js";export const Icons = {@@ -191,8 +192,8 @@ export const Icons = {chevronLeft: mdiChevronLeft,circle: mdiCircle,arrowLeft: mdiArrowLeft,-- none: "",+ resize: mdiResizeBottomRight,+ none: ""};export type IconNames = keyof typeof Icons;