added new customized menu

This commit is contained in:
zsviczian
2023-01-09 23:05:48 +01:00
parent 68c7c9f55e
commit 70d93602f7
3 changed files with 121 additions and 2 deletions

View File

@@ -93,6 +93,8 @@ import { ToolsPanel } from "./menu/ToolsPanel";
import { ScriptEngine } from "./Scripts";
import { getTextElementAtPointer, getImageElementAtPointer, getElementWithLinkAtPointer } from "./utils/GetElementAtPointer";
import { MenuLinks } from "./menu/menuLinks";
import { ICONS } from "./menu/ActionIcons";
export enum TextMode {
parsed = "parsed",
@@ -2627,6 +2629,7 @@ export default class ExcalidrawView extends TextFileView {
const {
Excalidraw,
MainMenu
} = this.plugin.getPackage(this.ownerWindow).excalidrawLib;
const excalidrawDiv = React.createElement(
@@ -3302,7 +3305,50 @@ export default class ExcalidrawView extends TextFileView {
}
},
}//,React.createElement(Footer,{},React.createElement(customTextEditor.render)),
),
,React.createElement(
MainMenu,
{},
React.createElement(MainMenu.DefaultItems.Help),
React.createElement(MainMenu.DefaultItems.ClearCanvas),
React.createElement(MainMenu.Separator),
React.createElement(
MainMenu.ItemLink,
{
icon: ICONS.YouTube,
href: "https://www.youtube.com/@VisualPKM",
ariaLabel: "Visual PKM YouTube Channel",
},"Visual PKM YouTube"
),
React.createElement(
MainMenu.ItemLink,
{
icon: ICONS.Github,
href: "https://github.com/zsviczian/obsidian-excalidraw-plugin/#readme",
ariaLabel: "Find help on GitHub",
},"Find help on GitHub"
),
React.createElement(
MainMenu.ItemLink,
{
icon: ICONS.heart,
href: "https://ko-fi.com/zsolt",
ariaLabel: "Donate to support Excalidraw",
},"Say thank you!"
),
React.createElement(
MainMenu.ItemLink,
{
icon: ICONS.twitter,
href: "https://twitter.com/zsviczian",
ariaLabel: "Follow me on Twitter",
},"Find me on Twitter"
),
React.createElement(MainMenu.Separator),
React.createElement(MainMenu.DefaultItems.ToggleTheme),
React.createElement(MainMenu.DefaultItems.ChangeCanvasBackground),
)),
React.createElement(ToolsPanel, {
ref: toolsPanelRef,
visible: false,

View File

@@ -1,6 +1,79 @@
import * as React from "react";
export const ICONS = {
Github: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4">
</path>
<path
d="M9 18c-4.51 2-5-2-7-2">
</path>
</svg>
),
YouTube: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M12 19c-2.3 0-6.4-.2-8.1-.6-.7-.2-1.2-.7-1.4-1.4-.3-1.1-.5-3.4-.5-5s.2-3.9.5-5c.2-.7.7-1.2 1.4-1.4C5.6 5.2 9.7 5 12 5s6.4.2 8.1.6c.7.2 1.2.7 1.4 1.4.3 1.1.5 3.4.5 5s-.2 3.9-.5 5c-.2.7-.7 1.2-1.4 1.4-1.7.4-5.8.6-8.1.6 0 0 0 0 0 0z">
</path>
<polygon points="10 15 15 12 10 9"></polygon>
</svg>
)
,
heart: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M20.42 4.58a5.4 5.4 0 0 0-7.65 0l-.77.78-.77-.78a5.4 5.4 0 0 0-7.65 0C1.46 6.7 1.33 10.28 4 13l8 8 8-8c2.67-2.72 2.54-6.3.42-8.42z">
</path>
</svg>
),
twitter: (
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z">
</path>
</svg>
),
exportLibrary: (
<svg
aria-hidden="true"

View File

@@ -276,7 +276,7 @@ textarea.excalidraw-wysiwyg {
}
label.color-input-container > input {
max-width: 8rem;
max-width: 7rem;
}
.excalidraw .FixedSideContainer_side_top {