Skip to content

Commit

Permalink
Fix imports of domchange workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
salmenf committed Aug 20, 2024
1 parent 5562b33 commit f293720
Show file tree
Hide file tree
Showing 14 changed files with 5,775 additions and 5 deletions.
2 changes: 1 addition & 1 deletion @webwriter/core/view/editor/nodeviews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EditorStateWithHead, getAttrs, globalHTMLAttributes, toAttributes } fro
import {EditorViewController} from "."
import { selectParentNode } from "prosemirror-commands"
import { filterObject, sameMembers, shallowCompare, browser } from "../../utility"
import { readDOMChange } from "./domchange"
import { readDOMChange } from "./prosemirror-view/domchange"



Expand Down
34 changes: 34 additions & 0 deletions @webwriter/core/view/editor/prosemirror-view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ProseMirror's view module displays a given [editor
state](#state.EditorState) in the DOM, and handles user events.

Make sure you load `style/prosemirror.css` as a stylesheet when using
this module.

@EditorView

### Props

@EditorProps

@NodeViewConstructor

@MarkViewConstructor

@DirectEditorProps

@NodeView

@DOMEventMap

### Decorations

Decorations make it possible to influence the way the document is
drawn, without actually changing the document.

@Decoration

@DecorationAttrs

@DecorationSet

@DecorationSource
24 changes: 24 additions & 0 deletions @webwriter/core/view/editor/prosemirror-view/browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const nav = typeof navigator != "undefined" ? navigator : null
const doc = typeof document != "undefined" ? document : null
const agent = (nav && nav.userAgent) || ""

const ie_edge = /Edge\/(\d+)/.exec(agent)
const ie_upto10 = /MSIE \d/.exec(agent)
const ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent)

export const ie = !!(ie_upto10 || ie_11up || ie_edge)
export const ie_version = ie_upto10 ? (document as any).documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0
export const gecko = !ie && /gecko\/(\d+)/i.test(agent)
export const gecko_version = gecko && +(/Firefox\/(\d+)/.exec(agent) || [0, 0])[1]

const _chrome = !ie && /Chrome\/(\d+)/.exec(agent)
export const chrome = !!_chrome
export const chrome_version = _chrome ? +_chrome[1] : 0
export const safari = !ie && !!nav && /Apple Computer/.test(nav.vendor)
// Is true for both iOS and iPadOS for convenience
export const ios = safari && (/Mobile\/\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2)
export const mac = ios || (nav ? /Mac/.test(nav.platform) : false)
export const windows = nav ? /Win/.test(nav.platform) : false
export const android = /Android \d/.test(agent)
export const webkit = !!doc && "webkitFontSmoothing" in doc.documentElement.style
export const webkit_version = webkit ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0
Loading

0 comments on commit f293720

Please sign in to comment.