Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/default spannar menu #92

Merged
merged 7 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/blocky-core/css/blocky-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
.blocky-editor-toolbar-delegate {
position: absolute;
z-index: 11;
transition-property: opacity, transform;
transition-duration: 200ms;
transition-timing-function: ease;
}

/* https://stackoverflow.com/questions/826782/how-to-disable-text-selection-highlighting */
Expand Down
4 changes: 4 additions & 0 deletions packages/blocky-core/src/view/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,10 @@ export class Editor {
return undefined;
}

get fontFamily(): string {
return this.themeData?.font ?? blockyDefaultFonts;
}

handleBlocksContainerMouseMove(e: MouseEvent) {
const y = e.clientY;
const blockSizes = this.#collectBlocksSize();
Expand Down
2 changes: 2 additions & 0 deletions packages/blocky-core/src/view/toolbarDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class ToolbarDelegate extends UIDelegate {
this.#debounced = undefined;
}
super.hide();
this.container.style.opacity = "0";
}

override show() {
Expand All @@ -77,6 +78,7 @@ export class ToolbarDelegate extends UIDelegate {
}
this.#debounced = undefined;
this.container.style.display = "";
this.container.style.opacity = "1";
this.shown = true;
if (this.shown) {
this.container.style.top = this.#y + "px";
Expand Down
5 changes: 2 additions & 3 deletions packages/blocky-example/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ import {
makeImageBlockPlugin,
type SpannerRenderProps,
DefaultToolbarMenu,
DefaultSpannerMenu,
} from "blocky-react";
import SearchBox from "@pkg/components/searchBox";
import ImagePlaceholder from "@pkg/components/imagePlaceholder";
import { makeCommandPanelPlugin } from "./plugins/commandPanel";
import { makeAtPanelPlugin } from "./plugins/atPanel";
import SpannerMenu from "./spannerMenu";
// import ToolbarMenu from "./toolbarMenu";
import TianShuiWeiImage from "./tianshuiwei.jpg";
import Image from "next/image";
import { blockyExampleFont, Theme } from "./themeSwitch";
Expand Down Expand Up @@ -63,7 +62,7 @@ function makeController(userId: string, title: string): EditorController {
*/
spannerFactory: makeReactSpanner(
({ editorController, focusedNode }: SpannerRenderProps) => (
<SpannerMenu
<DefaultSpannerMenu
editorController={editorController}
focusedNode={focusedNode}
/>
Expand Down
27 changes: 0 additions & 27 deletions packages/blocky-example/app/spannerMenu.scss

This file was deleted.

177 changes: 0 additions & 177 deletions packages/blocky-example/app/spannerMenu.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions packages/blocky-example/components/dropdown/dropdown.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions packages/blocky-example/components/menu/menu.scss

This file was deleted.

43 changes: 0 additions & 43 deletions packages/blocky-example/components/menu/menu.tsx

This file was deleted.

Loading
Loading