Merge branch 'main' of github.com:ueberdosis/tiptap

This commit is contained in:
Hans Pagel
2021-08-27 12:31:31 +02:00
11 changed files with 80 additions and 19 deletions

View File

@@ -20,6 +20,7 @@
"@types/prosemirror-state": "^1.2.7", "@types/prosemirror-state": "^1.2.7",
"@types/prosemirror-transform": "^1.1.4", "@types/prosemirror-transform": "^1.1.4",
"@types/prosemirror-view": "^1.17.2", "@types/prosemirror-view": "^1.17.2",
"@types/uuid": "^8.3.1",
"@vitejs/plugin-react-refresh": "^1.3.6", "@vitejs/plugin-react-refresh": "^1.3.6",
"autoprefixer": "^10.3.1", "autoprefixer": "^10.3.1",
"iframe-resizer": "^4.3.2", "iframe-resizer": "^4.3.2",

View File

@@ -38,7 +38,7 @@
<div class="flex overflow-x-auto"> <div class="flex overflow-x-auto">
<div class="flex flex-auto px-4 border-b-2 border-gray-800"> <div class="flex flex-auto px-4 border-b-2 border-gray-800">
<button <button
class="inline-flex relative mr-4 py-2 pb-[calc(0.3rem + 2px)] mb-[-2px] border-b-2 border-transparent font-mono text-sm" class="inline-flex relative mr-4 py-2 pb-[calc(0.3rem + 2px)] mb-[-2px] border-b-2 border-transparent font-mono text-sm whitespace-nowrap"
:class="[!showDebug && currentFile.content === file.content :class="[!showDebug && currentFile.content === file.content
? 'text-white border-white font-bold' ? 'text-white border-white font-bold'
: 'text-gray-400' : 'text-gray-400'
@@ -74,10 +74,10 @@
</div> </div>
<div class="flex justify-between px-4 py-2 text-md text-gray-400 border-t border-gray-800"> <div class="flex justify-between px-4 py-2 text-md text-gray-400 border-t border-gray-800">
<a :href="currentIframeUrl"> <a class="flex-shrink min-w-0 overflow-ellipsis overflow-hidden whitespace-nowrap" :href="currentIframeUrl">
{{ name }}/{{ currentTab }} {{ name }}/{{ currentTab }}
</a> </a>
<a :href="githubUrl" target="_blank"> <a class="whitespace-nowrap pl-4" :href="githubUrl" target="_blank">
Edit on GitHub Edit on GitHub
</a> </a>
</div> </div>

View File

@@ -1,4 +1,3 @@
// @ts-nocheck
import { import {
resolve, resolve,
basename, basename,
@@ -26,12 +25,15 @@ export default defineConfig({
'prosemirror-history', 'prosemirror-history',
'prosemirror-dropcursor', 'prosemirror-dropcursor',
'prosemirror-gapcursor', 'prosemirror-gapcursor',
'prosemirror-tables',
'tippy.js', 'tippy.js',
'yjs', 'yjs',
'y-prosemirror', 'y-prosemirror',
'y-websocket', 'y-websocket',
'y-indexeddb', 'y-indexeddb',
'y-webrtc', 'y-webrtc',
'lowlight',
'lowlight/lib/core',
], ],
}, },
@@ -50,7 +52,7 @@ export default defineConfig({
{ {
name: 'raw', name: 'raw',
resolveId(id, importer) { resolveId(id, importer) {
if (id.startsWith('raw!')) { if (id.startsWith('raw!') && importer) {
const [, relativePath] = id.split('raw!') const [, relativePath] = id.split('raw!')
const fullPath = join(dirname(importer), relativePath) const fullPath = join(dirname(importer), relativePath)
@@ -100,7 +102,7 @@ export default defineConfig({
{ {
name: 'source', name: 'source',
resolveId(id, importer) { resolveId(id, importer) {
if (id === '@source') { if (id === '@source' && importer) {
return `source!${dirname(importer)}!!${uuid()}` return `source!${dirname(importer)}!!${uuid()}`
} }
}, },
@@ -123,6 +125,31 @@ export default defineConfig({
content: fs.readFileSync(`${path}/${name}`, 'utf8'), content: fs.readFileSync(`${path}/${name}`, 'utf8'),
} }
}) })
.sort((a, b) => {
const depthA = a.name.split('/').length
const depthB = b.name.split('/').length
if (depthA > depthB) {
return 1
}
if (depthA < depthB) {
return -1
}
const aIsIndex = basename(a.name).includes('index.')
const bIsIndex = basename(b.name).includes('index.')
if (aIsIndex) {
return -1
}
if (bIsIndex) {
return 1
}
return 0
})
return `export default ${JSON.stringify(files)}` return `export default ${JSON.stringify(files)}`
} }
@@ -135,7 +162,7 @@ export default defineConfig({
configureServer(viteDevServer) { configureServer(viteDevServer) {
return () => { return () => {
viteDevServer.middlewares.use(async (req, res, next) => { viteDevServer.middlewares.use(async (req, res, next) => {
if (req.originalUrl.startsWith('/preview')) { if (req?.originalUrl?.startsWith('/preview')) {
req.url = '/preview/index.html' req.url = '/preview/index.html'
} }
@@ -155,11 +182,4 @@ export default defineConfig({
}), }),
], ],
}, },
// server: {
// fs: {
// // Allow serving files from one level up to the project root
// allow: ['..']
// }
// }
}) })

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.102](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.101...@tiptap/core@2.0.0-beta.102) (2021-08-26)
### Bug Fixes
* fix focus on iOS, fix [#1806](https://github.com/ueberdosis/tiptap/issues/1806) ([3a06938](https://github.com/ueberdosis/tiptap/commit/3a0693869d10793620e0073b0782dd34ac5aea89))
# [2.0.0-beta.101](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.100...@tiptap/core@2.0.0-beta.101) (2021-08-24) # [2.0.0-beta.101](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.100...@tiptap/core@2.0.0-beta.101) (2021-08-24)

View File

@@ -1,7 +1,7 @@
{ {
"name": "@tiptap/core", "name": "@tiptap/core",
"description": "headless rich text editor", "description": "headless rich text editor",
"version": "2.0.0-beta.101", "version": "2.0.0-beta.102",
"homepage": "https://tiptap.dev", "homepage": "https://tiptap.dev",
"keywords": [ "keywords": [
"tiptap", "tiptap",

View File

@@ -2,6 +2,7 @@ import { EditorState, Selection, TextSelection } from 'prosemirror-state'
import { RawCommands, FocusPosition } from '../types' import { RawCommands, FocusPosition } from '../types'
import minMax from '../utilities/minMax' import minMax from '../utilities/minMax'
import isTextSelection from '../helpers/isTextSelection' import isTextSelection from '../helpers/isTextSelection'
import isiOS from '../utilities/isiOS'
function resolveSelection(state: EditorState, position: FocusPosition = null) { function resolveSelection(state: EditorState, position: FocusPosition = null) {
if (!position) { if (!position) {
@@ -48,11 +49,18 @@ export const focus: RawCommands['focus'] = (position = null) => ({
dispatch, dispatch,
}) => { }) => {
const delayedFocus = () => { const delayedFocus = () => {
// focus within `requestAnimationFrame` breaks focus on iOS
// so we have to call this
if (isiOS()) {
(view.dom as HTMLElement).focus()
}
// For React we have to focus asynchronously. Otherwise wild things happen. // For React we have to focus asynchronously. Otherwise wild things happen.
// see: https://github.com/ueberdosis/tiptap/issues/1520 // see: https://github.com/ueberdosis/tiptap/issues/1520
requestAnimationFrame(() => { requestAnimationFrame(() => {
if (!editor.isDestroyed) { if (!editor.isDestroyed) {
view.focus() view.focus()
editor.commands.scrollIntoView()
} }
}) })
} }

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.101](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.100...@tiptap/html@2.0.0-beta.101) (2021-08-26)
**Note:** Version bump only for package @tiptap/html
# [2.0.0-beta.100](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.99...@tiptap/html@2.0.0-beta.100) (2021-08-24) # [2.0.0-beta.100](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.99...@tiptap/html@2.0.0-beta.100) (2021-08-24)
**Note:** Version bump only for package @tiptap/html **Note:** Version bump only for package @tiptap/html

View File

@@ -1,7 +1,7 @@
{ {
"name": "@tiptap/html", "name": "@tiptap/html",
"description": "utility package to render tiptap JSON as HTML", "description": "utility package to render tiptap JSON as HTML",
"version": "2.0.0-beta.100", "version": "2.0.0-beta.101",
"homepage": "https://tiptap.dev", "homepage": "https://tiptap.dev",
"keywords": [ "keywords": [
"tiptap", "tiptap",
@@ -21,7 +21,7 @@
"dist" "dist"
], ],
"dependencies": { "dependencies": {
"@tiptap/core": "^2.0.0-beta.101", "@tiptap/core": "^2.0.0-beta.102",
"hostic-dom": "^0.8.7", "hostic-dom": "^0.8.7",
"prosemirror-model": "^1.14.3" "prosemirror-model": "^1.14.3"
}, },

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.101](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.100...@tiptap/starter-kit@2.0.0-beta.101) (2021-08-26)
**Note:** Version bump only for package @tiptap/starter-kit
# [2.0.0-beta.100](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.99...@tiptap/starter-kit@2.0.0-beta.100) (2021-08-26) # [2.0.0-beta.100](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.99...@tiptap/starter-kit@2.0.0-beta.100) (2021-08-26)
**Note:** Version bump only for package @tiptap/starter-kit **Note:** Version bump only for package @tiptap/starter-kit

View File

@@ -1,7 +1,7 @@
{ {
"name": "@tiptap/starter-kit", "name": "@tiptap/starter-kit",
"description": "starter kit for tiptap", "description": "starter kit for tiptap",
"version": "2.0.0-beta.100", "version": "2.0.0-beta.101",
"homepage": "https://tiptap.dev", "homepage": "https://tiptap.dev",
"keywords": [ "keywords": [
"tiptap", "tiptap",
@@ -21,7 +21,7 @@
"dist" "dist"
], ],
"dependencies": { "dependencies": {
"@tiptap/core": "^2.0.0-beta.101", "@tiptap/core": "^2.0.0-beta.102",
"@tiptap/extension-blockquote": "^2.0.0-beta.15", "@tiptap/extension-blockquote": "^2.0.0-beta.15",
"@tiptap/extension-bold": "^2.0.0-beta.15", "@tiptap/extension-bold": "^2.0.0-beta.15",
"@tiptap/extension-bullet-list": "^2.0.0-beta.15", "@tiptap/extension-bullet-list": "^2.0.0-beta.15",

View File

@@ -2465,6 +2465,11 @@
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ== integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==
"@types/uuid@^8.3.1":
version "8.3.1"
resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-8.3.1.tgz#1a32969cf8f0364b3d8c8af9cc3555b7805df14f"
integrity sha512-Y2mHTRAbqfFkpjldbkHGY8JIzRN6XqYRliG8/24FcHm2D2PwW24fl5xMRTVGdrb7iMrwCaIEbLWerGIkXuFWVg==
"@types/vfile-message@*": "@types/vfile-message@*":
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/vfile-message/-/vfile-message-2.0.0.tgz#690e46af0fdfc1f9faae00cd049cc888957927d5" resolved "https://registry.yarnpkg.com/@types/vfile-message/-/vfile-message-2.0.0.tgz#690e46af0fdfc1f9faae00cd049cc888957927d5"