fixchunks
This commit is contained in:
parent
c88482f36a
commit
65d6c177ae
|
@ -44,6 +44,9 @@ const astroConfig: AstroUserConfig = {
|
|||
manualChunks(id) {
|
||||
if (id.includes('node_modules')) {
|
||||
let chunkid = 'vendor'
|
||||
if (id.includes('solid')) {
|
||||
chunkid = 'solid'
|
||||
}
|
||||
if (id.includes('acorn')) {
|
||||
chunkid = 'acorn'
|
||||
}
|
||||
|
@ -53,18 +56,12 @@ const astroConfig: AstroUserConfig = {
|
|||
if (id.includes('prosemirror')) {
|
||||
chunkid = 'prosemirror'
|
||||
}
|
||||
if (id.includes('markdown')) {
|
||||
if (id.includes('markdown') || id.includes('mdurl')) {
|
||||
chunkid = 'markdown'
|
||||
}
|
||||
if (id.includes('swiper')) {
|
||||
chunkid = 'swiper'
|
||||
}
|
||||
if (id.includes('remark') || id.includes('rehype') || id.includes('micromark')) {
|
||||
chunkid = 'remark'
|
||||
}
|
||||
if (id.includes('parse5')) {
|
||||
chunkid = 'parse5'
|
||||
}
|
||||
if (
|
||||
id.includes('yjs') ||
|
||||
id.includes('y-prosemirror') ||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
@import './Button';
|
||||
|
||||
.editor {
|
||||
flex: 1;
|
||||
padding-top: 1em;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { Switch, Match } from 'solid-js'
|
||||
import { useState } from './prosemirror/context'
|
||||
import './Button.scss'
|
||||
import { Switch, Match, createMemo } from 'solid-js'
|
||||
import { ErrorObject, useState } from './store'
|
||||
|
||||
const InvalidState = (props: { title: string }) => {
|
||||
const [store, ctrl] = useState()
|
||||
|
@ -16,7 +15,7 @@ const InvalidState = (props: { title: string }) => {
|
|||
you can copy important notes from below, clean the state and paste it again.
|
||||
</p>
|
||||
<pre>
|
||||
<code>{JSON.stringify(store.error?.props)}</code>
|
||||
<code>{JSON.stringify(store.error)}</code>
|
||||
</pre>
|
||||
<button class="primary" onClick={onClick}>
|
||||
Clean
|
||||
|
@ -29,12 +28,7 @@ const InvalidState = (props: { title: string }) => {
|
|||
const Other = () => {
|
||||
const [store, ctrl] = useState()
|
||||
const onClick = () => ctrl.discard()
|
||||
|
||||
const getMessage = () => {
|
||||
const err = (store.error?.props as any).error
|
||||
|
||||
return typeof err === 'string' ? err : err.message
|
||||
}
|
||||
const getMessage = createMemo<ErrorObject['message']>(() => store.error.message)
|
||||
|
||||
return (
|
||||
<div class="error" data-tauri-drag-region="true">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import './Editor.scss'
|
||||
import type { EditorView } from 'prosemirror-view'
|
||||
import type { EditorState } from 'prosemirror-state'
|
||||
import { useState } from './prosemirror/context'
|
||||
import { useState } from './store'
|
||||
import { ProseMirror } from './prosemirror'
|
||||
import './Editor.scss'
|
||||
|
||||
export default () => {
|
||||
const [store, ctrl] = useState()
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
import { createContext, useContext } from 'solid-js'
|
||||
import type { Store } from 'solid-js/store'
|
||||
import type { XmlFragment } from 'yjs'
|
||||
import type { WebrtcProvider } from 'y-webrtc'
|
||||
import type { ProseMirrorExtension, ProseMirrorState } from './state'
|
||||
import type { Reaction } from '../../../graphql/types.gen'
|
||||
|
||||
export const isMac = true
|
||||
|
||||
export const mod = isMac ? 'Cmd' : 'Ctrl'
|
||||
export const alt = isMac ? 'Cmd' : 'Alt'
|
||||
|
||||
export interface Args {
|
||||
cwd?: string
|
||||
file?: string
|
||||
room?: string
|
||||
text?: any
|
||||
}
|
||||
|
||||
export interface PrettierConfig {
|
||||
printWidth: number
|
||||
tabWidth: number
|
||||
useTabs: boolean
|
||||
semi: boolean
|
||||
singleQuote: boolean
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
theme: string
|
||||
// codeTheme: string;
|
||||
font: string
|
||||
fontSize: number
|
||||
contentWidth: number
|
||||
alwaysOnTop: boolean
|
||||
// typewriterMode: boolean;
|
||||
prettier: PrettierConfig
|
||||
}
|
||||
|
||||
export interface ErrorObject {
|
||||
id: string
|
||||
props?: unknown
|
||||
}
|
||||
|
||||
export interface YOptions {
|
||||
type: XmlFragment
|
||||
provider: WebrtcProvider
|
||||
}
|
||||
|
||||
export interface Collab {
|
||||
started?: boolean
|
||||
error?: boolean
|
||||
room?: string
|
||||
y?: YOptions
|
||||
}
|
||||
|
||||
export type LoadingType = 'loading' | 'initialized'
|
||||
|
||||
export interface File {
|
||||
text?: { [key: string]: any }
|
||||
lastModified?: string
|
||||
path?: string
|
||||
markdown?: boolean
|
||||
}
|
||||
|
||||
export interface State {
|
||||
text?: ProseMirrorState
|
||||
editorView?: any
|
||||
extensions?: ProseMirrorExtension[]
|
||||
markdown?: boolean
|
||||
lastModified?: Date
|
||||
files: File[]
|
||||
config: Config
|
||||
error?: ErrorObject
|
||||
loading: LoadingType
|
||||
fullscreen: boolean
|
||||
collab?: Collab
|
||||
path?: string
|
||||
args?: Args
|
||||
}
|
||||
|
||||
export class ServiceError extends Error {
|
||||
public errorObject: ErrorObject
|
||||
constructor(id: string, props: unknown) {
|
||||
super(id)
|
||||
this.errorObject = { id, props }
|
||||
}
|
||||
}
|
||||
|
||||
const DEFAULT_CONFIG = {
|
||||
theme: '',
|
||||
// codeTheme: 'material-light',
|
||||
font: 'muller',
|
||||
fontSize: 24,
|
||||
contentWidth: 800,
|
||||
alwaysOnTop: isMac,
|
||||
// typewriterMode: true,
|
||||
prettier: {
|
||||
printWidth: 80,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: true
|
||||
}
|
||||
}
|
||||
|
||||
export const StateContext = createContext<[Store<State>, any]>([{} as Store<State>, undefined])
|
||||
|
||||
export const useState = () => useContext(StateContext)
|
||||
|
||||
export const newState = (props: Partial<State> = {}): State => ({
|
||||
extensions: [],
|
||||
files: [],
|
||||
loading: 'loading',
|
||||
fullscreen: false,
|
||||
markdown: false,
|
||||
config: DEFAULT_CONFIG,
|
||||
...props
|
||||
})
|
|
@ -1,6 +1,6 @@
|
|||
import { ySyncPlugin, yCursorPlugin, yUndoPlugin } from 'y-prosemirror'
|
||||
import type { ProseMirrorExtension } from '../state'
|
||||
import type { YOptions } from '../context'
|
||||
import type { YOptions } from '../../store'
|
||||
|
||||
export const cursorBuilder = (user: any): HTMLElement => {
|
||||
const cursor = document.createElement('span')
|
||||
|
|
|
@ -15,7 +15,7 @@ import dragHandle from './extension/drag-handle'
|
|||
import pasteMarkdown from './extension/paste-markdown'
|
||||
import table from './extension/table'
|
||||
import collab from './extension/collab'
|
||||
import type { Config, YOptions } from './context'
|
||||
import type { Config, YOptions } from '../store'
|
||||
import selectionMenu from './extension/selection'
|
||||
|
||||
interface Opts {
|
||||
|
|
|
@ -3,7 +3,13 @@ import type { Store } from 'solid-js/store'
|
|||
import type { XmlFragment } from 'yjs'
|
||||
import type { WebrtcProvider } from 'y-webrtc'
|
||||
import type { ProseMirrorExtension, ProseMirrorState } from '../prosemirror/state'
|
||||
import { isMac } from '../prosemirror/context'
|
||||
import type { Reaction } from '../../../graphql/types.gen'
|
||||
import type { EditorView } from 'prosemirror-view'
|
||||
|
||||
export const isMac = true
|
||||
|
||||
export const mod = isMac ? 'Cmd' : 'Ctrl'
|
||||
export const alt = isMac ? 'Cmd' : 'Alt'
|
||||
|
||||
export interface Args {
|
||||
cwd?: string
|
||||
|
@ -32,8 +38,9 @@ export interface Config {
|
|||
}
|
||||
|
||||
export interface ErrorObject {
|
||||
message: string
|
||||
id: string
|
||||
props?: unknown
|
||||
props: unknown
|
||||
}
|
||||
|
||||
export interface YOptions {
|
||||
|
@ -59,7 +66,7 @@ export interface File {
|
|||
|
||||
export interface State {
|
||||
text?: ProseMirrorState
|
||||
editorView?: any
|
||||
editorView?: EditorView
|
||||
extensions?: ProseMirrorExtension[]
|
||||
markdown?: boolean
|
||||
lastModified?: Date
|
||||
|
@ -77,7 +84,24 @@ export class ServiceError extends Error {
|
|||
public errorObject: ErrorObject
|
||||
constructor(id: string, props: unknown) {
|
||||
super(id)
|
||||
this.errorObject = { id, props }
|
||||
this.errorObject = { id, props, message: '' }
|
||||
}
|
||||
}
|
||||
|
||||
const DEFAULT_CONFIG = {
|
||||
theme: '',
|
||||
// codeTheme: 'material-light',
|
||||
font: 'muller',
|
||||
fontSize: 24,
|
||||
contentWidth: 800,
|
||||
alwaysOnTop: isMac,
|
||||
// typewriterMode: true,
|
||||
prettier: {
|
||||
printWidth: 80,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,21 +115,6 @@ export const newState = (props: Partial<State> = {}): State => ({
|
|||
loading: 'loading',
|
||||
fullscreen: false,
|
||||
markdown: false,
|
||||
config: {
|
||||
theme: 'light',
|
||||
// codeTheme: 'material-light',
|
||||
font: 'muller',
|
||||
fontSize: 24,
|
||||
contentWidth: 800,
|
||||
alwaysOnTop: isMac,
|
||||
// typewriterMode: true,
|
||||
prettier: {
|
||||
printWidth: 80,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: false,
|
||||
singleQuote: true
|
||||
}
|
||||
},
|
||||
config: DEFAULT_CONFIG,
|
||||
...props
|
||||
})
|
||||
|
|
|
@ -46,6 +46,7 @@ import { CreatePage } from './Pages/CreatePage'
|
|||
// const ProjectsPage = lazy(() => import('./Pages/about/ProjectsPage'))
|
||||
// const TermsOfUsePage = lazy(() => import('./Pages/about/TermsOfUsePage'))
|
||||
// const ThanksPage = lazy(() => import('./Pages/about/ThanksPage'))
|
||||
// const CreatePage = lazy(() => import('./Pages/about/CreatePage'))
|
||||
|
||||
const log = getLogger('root')
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import { Show, onCleanup, createEffect, onError, onMount, untrack } from 'solid-js'
|
||||
import { createMutable, unwrap } from 'solid-js/store'
|
||||
import { State, StateContext } from '../Editor/prosemirror/context'
|
||||
import { State, StateContext, newState } from '../Editor/store'
|
||||
import { createCtrl } from '../Editor/store/ctrl'
|
||||
import { Layout } from '../Editor/Layout'
|
||||
import Editor from '../Editor'
|
||||
import { Sidebar } from '../Editor/Sidebar'
|
||||
import ErrorView from '../Editor/Error'
|
||||
import { newState } from '../Editor/store'
|
||||
import { getLogger } from '../../utils/logger'
|
||||
|
||||
const log = getLogger('CreateView')
|
||||
|
@ -15,7 +14,7 @@ export const CreateView = () => {
|
|||
const [store, ctrl] = createCtrl(newState())
|
||||
const mouseEnterCoords = createMutable({ x: 0, y: 0 })
|
||||
|
||||
const onMouseEnter = (e: any) => {
|
||||
const onMouseEnter = (e: MouseEvent) => {
|
||||
mouseEnterCoords.x = e.pageX
|
||||
mouseEnterCoords.y = e.pageY
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user