Skip to content

Commit

Permalink
demo: fix build; fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
wenerme committed Sep 26, 2022
1 parent 4887d03 commit 5ea09aa
Show file tree
Hide file tree
Showing 66 changed files with 881 additions and 1,551 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
strict-peer-dependencies=true
auto-install-peers=false
auto-install-peers=true
legacy-peer-deps=false
registry=https://registry.npmmirror.com/
110 changes: 54 additions & 56 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,67 @@
{
"name": "@wener/demo",
"version": "0.1.0",
"private": true,
"type": "module",
"private": true,
"engines": {
"node": "16",
"pnpm": ">=7"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"dev": "next dev",
"lint": "next lint",
"start": "next start"
},
"dependencies": {
"@floating-ui/dom": "^1.0.1",
"@floating-ui/react-dom-interactions": "^0.9.3",
"@headlessui/react": "^1.7.1",
"@lexical/clipboard": "^0.4.1",
"@lexical/code": "^0.4.1",
"@lexical/hashtag": "^0.4.1",
"@lexical/link": "^0.4.1",
"@lexical/list": "^0.4.1",
"@lexical/mark": "^0.4.1",
"@lexical/overflow": "^0.4.1",
"@lexical/react": "^0.4.1",
"@lexical/rich-text": "^0.4.1",
"@lexical/selection": "^0.4.1",
"@lexical/table": "^0.4.1",
"@lexical/utils": "^0.4.1",
"@lexical/clipboard": "^0.5.0",
"@lexical/code": "^0.5.0",
"@lexical/hashtag": "^0.5.0",
"@lexical/link": "^0.5.0",
"@lexical/list": "^0.5.0",
"@lexical/mark": "^0.5.0",
"@lexical/overflow": "^0.5.0",
"@lexical/react": "^0.5.0",
"@lexical/rich-text": "^0.5.0",
"@lexical/selection": "^0.5.0",
"@lexical/table": "^0.5.0",
"@lexical/utils": "^0.5.0",
"@tailwindcss/typography": "^0.5.7",
"@tiptap/core": "^2.0.0-beta.194",
"@tiptap/extension-blockquote": "^2.0.0-beta.194",
"@tiptap/extension-bold": "^2.0.0-beta.194",
"@tiptap/extension-bullet-list": "^2.0.0-beta.194",
"@tiptap/extension-character-count": "^2.0.0-beta.194",
"@tiptap/extension-code": "^2.0.0-beta.194",
"@tiptap/extension-code-block": "^2.0.0-beta.194",
"@tiptap/extension-color": "^2.0.0-beta.194",
"@tiptap/extension-font-family": "^2.0.0-beta.194",
"@tiptap/extension-heading": "^2.0.0-beta.194",
"@tiptap/extension-highlight": "^2.0.0-beta.194",
"@tiptap/extension-history": "^2.0.0-beta.194",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.194",
"@tiptap/extension-image": "^2.0.0-beta.194",
"@tiptap/extension-italic": "^2.0.0-beta.194",
"@tiptap/extension-link": "^2.0.0-beta.194",
"@tiptap/extension-ordered-list": "^2.0.0-beta.194",
"@tiptap/extension-placeholder": "^2.0.0-beta.194",
"@tiptap/extension-strike": "^2.0.0-beta.194",
"@tiptap/extension-table": "^2.0.0-beta.194",
"@tiptap/extension-table-cell": "^2.0.0-beta.194",
"@tiptap/extension-table-header": "^2.0.0-beta.194",
"@tiptap/extension-table-row": "^2.0.0-beta.194",
"@tiptap/extension-task-item": "^2.0.0-beta.194",
"@tiptap/extension-task-list": "^2.0.0-beta.194",
"@tiptap/extension-text-align": "^2.0.0-beta.194",
"@tiptap/extension-text-style": "^2.0.0-beta.194",
"@tiptap/extension-underline": "^2.0.0-beta.194",
"@tiptap/html": "^2.0.0-beta.194",
"@tiptap/react": "^2.0.0-beta.194",
"@tiptap/starter-kit": "^2.0.0-beta.194",
"@tiptap/suggestion": "^2.0.0-beta.194",
"@tiptap/core": "^2.0.0-beta.196",
"@tiptap/extension-blockquote": "^2.0.0-beta.196",
"@tiptap/extension-bold": "^2.0.0-beta.196",
"@tiptap/extension-bullet-list": "^2.0.0-beta.196",
"@tiptap/extension-character-count": "^2.0.0-beta.196",
"@tiptap/extension-code": "^2.0.0-beta.196",
"@tiptap/extension-code-block": "^2.0.0-beta.196",
"@tiptap/extension-color": "^2.0.0-beta.196",
"@tiptap/extension-font-family": "^2.0.0-beta.196",
"@tiptap/extension-heading": "^2.0.0-beta.196",
"@tiptap/extension-highlight": "^2.0.0-beta.196",
"@tiptap/extension-history": "^2.0.0-beta.196",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.196",
"@tiptap/extension-image": "^2.0.0-beta.196",
"@tiptap/extension-italic": "^2.0.0-beta.196",
"@tiptap/extension-link": "^2.0.0-beta.196",
"@tiptap/extension-ordered-list": "^2.0.0-beta.196",
"@tiptap/extension-placeholder": "^2.0.0-beta.196",
"@tiptap/extension-strike": "^2.0.0-beta.196",
"@tiptap/extension-table": "^2.0.0-beta.196",
"@tiptap/extension-table-cell": "^2.0.0-beta.196",
"@tiptap/extension-table-header": "^2.0.0-beta.196",
"@tiptap/extension-table-row": "^2.0.0-beta.196",
"@tiptap/extension-task-item": "^2.0.0-beta.196",
"@tiptap/extension-task-list": "^2.0.0-beta.196",
"@tiptap/extension-text-align": "^2.0.0-beta.196",
"@tiptap/extension-text-style": "^2.0.0-beta.196",
"@tiptap/extension-underline": "^2.0.0-beta.196",
"@tiptap/html": "^2.0.0-beta.196",
"@tiptap/react": "^2.0.0-beta.196",
"@tiptap/starter-kit": "^2.0.0-beta.196",
"@tiptap/suggestion": "^2.0.0-beta.196",
"@trpc/client": "^9.27.2",
"@trpc/next": "^9.27.2",
"@trpc/react": "^9.27.2",
Expand All @@ -78,7 +82,7 @@
"html-react-parser": "^3.0.4",
"immer": "^9.0.15",
"json5": "^2.2.1",
"lexical": "^0.4.1",
"lexical": "^0.5.0",
"mammoth": "^1.5.1",
"markdown-it": "^13.0.1",
"next": "^12.3.0",
Expand Down Expand Up @@ -106,22 +110,16 @@
"zustand": "^4.1.1"
},
"devDependencies": {
"@types/eslint": "^8.4.6",
"@types/markdown-it": "^12.2.3",
"@types/node": "^16.11.58",
"@types/prosemirror-markdown": "^1.5.6",
"@types/react": "^18.0.19",
"@types/react-dom": "^18.0.6",
"@types/styled-components": "^5.1.26",
"eslint": "^8.23.1",
"eslint-config-next": "^12.3.0",
"eslint-config-next": "^12",
"next-transpile-modules": "^9.0.0",
"typescript": "^4.8.3"
},
"engines": {
"node": "16",
"pnpm": ">=7"
},
"browserslist": [
"last 10 chrome version"
]
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/components/MaybeLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import classNames from 'classnames';
import Link from 'next/link';
import { useRouter } from 'next/router';
import React, { useEffect, useState } from 'react';

const ActiveLink: React.FC<
React.AnchorHTMLAttributes<HTMLAnchorElement> & {
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/components/TipTapWord/CommandList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommandSuggestionItem } from '@src/components/TipTapWord/extensions/commands';
import React, { cloneElement, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
import { MdImage } from 'react-icons/md';
import classNames from 'classnames';
import { CommandSuggestionItem } from '@src/components/TipTapWord/extensions/commands';

export type CommandListRef = {
onKeyDown: (o: { event: KeyboardEvent }) => boolean;
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/components/TipTapWord/Menubar/Menubar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { HTMLProps } from 'react';
import { Editor } from '@tiptap/react';
import classNames from 'classnames';
import { Editor } from '@tiptap/react';
import { MenuToolItem } from '@src/components/TipTapWord/components/MenuToolItem';

const menus = [
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/components/TipTapWord/Statusbar/DataViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ButtonHTMLAttributes, memo, useEffect, useRef, useState } from 'react';
import { useEditorStore } from '@src/components/TipTapWord/useEditorStore';
import { useImmer } from 'use-immer';
import { createPortal } from 'react-dom';
import { useImmer } from 'use-immer';
import { Editor } from '@tiptap/react';
import { createMarkdownSerializer } from '@wener/tiptap';
import { useEditorStore } from '@src/components/TipTapWord/useEditorStore';

const modes: Record<
string,
Expand Down
8 changes: 4 additions & 4 deletions apps/demo/src/components/TipTapWord/TipTapWord.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Editor, useEditor } from '@tiptap/react';
import React, { useEffect, useState } from 'react';
import { Extensions } from '@tiptap/core';
import { Editor, useEditor } from '@tiptap/react';
import { TipTapWordStarterKit } from '@wener/tiptap';
import { TipTapWordEditor } from '@src/components/TipTapWord/TipTapWordEditor';
import { Slot, SlotProps } from '@src/components/TipTapWord/components/Slot';
import { TipTapWordStarterKit } from '@wener/tiptap';
import { Extensions } from '@tiptap/core';

export type TipTapWord = React.FC<
React.PropsWithChildren<{ useExtensions?: () => Extensions; onEditor?: (v: Editor) => void }>
Expand All @@ -17,7 +17,7 @@ export const TipTapWord: TipTapWord = ({ children, onEditor, useExtensions }) =>
const [value, setValue] = useState({ html: '', json: {} });
const editor = useEditor(
{
extensions: useExtensions?.() ?? [TipTapWordStarterKit.configure({})],
extensions: useExtensions?.() ?? ([TipTapWordStarterKit.configure({})] as Extensions),
content: value.html,
onUpdate(ctx) {
setValue({ html: ctx.editor.getHTML(), json: ctx.editor.getJSON() });
Expand Down
8 changes: 4 additions & 4 deletions apps/demo/src/components/TipTapWord/TipTapWordEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useEffect, useRef } from 'react';
import { Editor, EditorContent } from '@tiptap/react';
import { Menubar } from '@src/components/TipTapWord/Menubar/Menubar';
import { Statusbar } from '@src/components/TipTapWord/Statusbar/Statusbar';
import { Toolbar } from '@src/components/TipTapWord/Toolbar/Toolbar';
import { Viewer } from '@src/components/TipTapWord/Viewer';
import {
createEditorStore,
EditorStore,
EditorStoreProvider,
useEditorStoreApi,
} from '@src/components/TipTapWord/useEditorStore';
import { Menubar } from '@src/components/TipTapWord/Menubar/Menubar';
import { Toolbar } from '@src/components/TipTapWord/Toolbar/Toolbar';
import { Viewer } from '@src/components/TipTapWord/Viewer';
import { Statusbar } from '@src/components/TipTapWord/Statusbar/Statusbar';

const EditorStoreConnector: React.FC<Partial<EditorStore>> = ({ editor, editorDomRef }) => {
let api = useEditorStoreApi();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Popover } from '@headlessui/react';
import classNames from 'classnames';
import { Popover } from '@headlessui/react';
import { ColorPlates } from '@src/components/TipTapWord/components/ColorPlates';

export const ColorPickerToolbarItem: React.FC<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react';
import { useCurrentEditor } from '@src/components/TipTapWord/hooks';
import { MdImage } from 'react-icons/md';
import { SimpleDialog } from '@src/components/TipTapWord/components/SimpleDialog';
import { SimpleFileInput } from '@src/components/TipTapWord/components/SimpleFileInput';
import { useCurrentEditor } from '@src/components/TipTapWord/hooks';

export const ImageToolbarItem: React.FC<{}> = (props) => {
let [open, setOpen] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Editor } from '@tiptap/react';
import { ColorPickerToolbarItem } from '@src/components/TipTapWord/Toolbar/ColorPickerToolbarItem';
import { MdBrush } from 'react-icons/md';
import type {} from '@tiptap/extension-highlight';
import { Editor } from '@tiptap/react';
import { ColorPickerToolbarItem } from '@src/components/TipTapWord/Toolbar/ColorPickerToolbarItem';

export const MarkColorToolbarItem: React.FC<{ editor: Editor; className?: string }> = ({ editor, className }) => {
const value = editor.getAttributes('highlight')?.color || '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Editor } from '@tiptap/react';
import { ColorPickerToolbarItem } from '@src/components/TipTapWord/Toolbar/ColorPickerToolbarItem';
import { ImTextColor } from 'react-icons/im';
import type {} from '@tiptap/extension-color';
import { Editor } from '@tiptap/react';
import { ColorPickerToolbarItem } from '@src/components/TipTapWord/Toolbar/ColorPickerToolbarItem';

export const TextColorToolbarItem: React.FC<{ editor: Editor }> = ({ editor }) => {
const value = editor.getAttributes('textStyle')?.color || '';
Expand Down
38 changes: 19 additions & 19 deletions apps/demo/src/components/TipTapWord/Toolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import React, { cloneElement, HTMLProps, useRef, useState } from 'react';
import { BsLayoutSplit, BsLayoutThreeColumns } from 'react-icons/bs';
import { CgQuote } from 'react-icons/cg';
import {
MdArrowDropDown,
MdAutoAwesome,
Expand Down Expand Up @@ -33,33 +36,30 @@ import {
MdTablet,
MdUndo,
} from 'react-icons/md';
import React, { cloneElement, HTMLProps, useRef, useState } from 'react';
import classNames, { Argument } from 'classnames';
import styled from 'styled-components';
import { Listbox } from '@headlessui/react';
import { FakeInput } from '@src/components/TipTapWord/components/FakeInput';
import type {} from '@tiptap/core';
import type {} from '@tiptap/extension-blockquote';
import type {} from '@tiptap/extension-bullet-list';
import type {} from '@tiptap/extension-code';
import type {} from '@tiptap/extension-code-block';
import type {} from '@tiptap/extension-font-family';
import type {} from '@tiptap/extension-heading';
import type {} from '@tiptap/extension-history';
import type {} from '@tiptap/extension-ordered-list';
import type {} from '@tiptap/extension-table';
import type {} from '@tiptap/extension-text-align';
import { ChainedCommands, Editor } from '@tiptap/react';
import classNames, { Argument } from 'classnames';
import { CgQuote } from 'react-icons/cg';
import { BsLayoutSplit, BsLayoutThreeColumns } from 'react-icons/bs';
import { MenuSpec, MenuToolItem } from '@src/components/TipTapWord/components/MenuToolItem';
import { useEditorStore, useEditorStoreApi } from '@src/components/TipTapWord/useEditorStore';
import { ImageToolbarItem } from '@src/components/TipTapWord/Toolbar/ImageToolbarItem';
import { isActive } from '@src/components/TipTapWord/Toolbar/IsActive';
import { MarkColorToolbarItem } from '@src/components/TipTapWord/Toolbar/MarkColorToolbarItem';
import { TextColorToolbarItem } from '@src/components/TipTapWord/Toolbar/TextColorToolbarItem';
import { ImageToolbarItem } from '@src/components/TipTapWord/Toolbar/ImageToolbarItem';
import { VideoToolbarItem } from '@src/components/TipTapWord/Toolbar/VideoToolbarItem';
import { FakeInput } from '@src/components/TipTapWord/components/FakeInput';
import { MenuSpec, MenuToolItem } from '@src/components/TipTapWord/components/MenuToolItem';
import { useEditorDerivedState } from '@src/components/TipTapWord/hooks';
import type {} from '@tiptap/extension-font-family';
import type {} from '@tiptap/extension-text-align';
import type {} from '@tiptap/extension-table';
import type {} from '@tiptap/extension-heading';
import type {} from '@tiptap/extension-code-block';
import type {} from '@tiptap/extension-blockquote';
import type {} from '@tiptap/extension-ordered-list';
import type {} from '@tiptap/extension-bullet-list';
import type {} from '@tiptap/extension-code';
import type {} from '@tiptap/extension-history';
import type {} from '@tiptap/core';
import { useEditorStore, useEditorStoreApi } from '@src/components/TipTapWord/useEditorStore';

const FontFamilySet: OptionItem[] = [
{ label: '默认字体', value: '' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useState } from 'react';
import { useCurrentEditor } from '@src/components/TipTapWord/hooks';
import { MdVideoLibrary } from 'react-icons/md';
import { SimpleDialog } from '@src/components/TipTapWord/components/SimpleDialog';
import { SimpleFileInput } from '@src/components/TipTapWord/components/SimpleFileInput';
import { useCurrentEditor } from '@src/components/TipTapWord/hooks';

export const VideoToolbarItem: React.FC<{}> = (props) => {
let [open, setOpen] = useState(false);
Expand Down
4 changes: 2 additions & 2 deletions apps/demo/src/components/TipTapWord/Viewer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEditorStore } from '@src/components/TipTapWord/useEditorStore';
import React from 'react';
import classNames from 'classnames';
import styled from 'styled-components';
import React from 'react';
import { useEditorStore } from '@src/components/TipTapWord/useEditorStore';

const DeviceSize: Record<string, string> = {
mobile: 'max-w-screen-sm',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { MouseEvent, useRef } from 'react';
import { MdAddCircleOutline, MdOutlineFormatColorReset } from 'react-icons/md';
import classNames from 'classnames';
import styled from 'styled-components';
import React, { MouseEvent, useRef } from 'react';

const colors: Array<[string, string, boolean]> = [
['黑色', '#000000', true],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { HTMLProps, KeyboardEventHandler } from 'react';
import styled from 'styled-components';
import { MdAdd, MdRemove } from 'react-icons/md';
import styled from 'styled-components';

export interface FakeInputProps {
value?: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/src/components/TipTapWord/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, {
useRef,
useState,
} from 'react';
import cx from 'classnames';
import { autoUpdate, flip, offset, shift } from '@floating-ui/dom';
import {
FloatingFocusManager,
Expand All @@ -28,7 +29,6 @@ import {
useRole,
useTypeahead,
} from '@floating-ui/react-dom-interactions';
import cx from 'classnames';
import { mergeRefs } from '@wener/reaction';

export const MenuItem = forwardRef<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from 'styled-components';
import { MdSettings } from 'react-icons/md';
import React, { MouseEvent, MouseEventHandler, useMemo, useRef } from 'react';
import { MdSettings } from 'react-icons/md';
import classNames from 'classnames';
import styled from 'styled-components';
import { Menu, MenuItem } from '@src/components/TipTapWord/components/Menu';

const MenuContainer = styled.div`
Expand Down
Loading

1 comment on commit 5ea09aa

@vercel
Copy link

@vercel vercel bot commented on 5ea09aa Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wode – ./

wode-wener.vercel.app
wode-git-main-wener.vercel.app
wode.vercel.app

Please sign in to comment.