Compare commits

...

6 commits

Author SHA1 Message Date
ec3d01960a
refactor: sort compsables 2023-04-01 20:13:29 +08:00
5d1cf237b7
chore: update dependecies 2023-04-01 18:43:04 +08:00
864fc716f9
style: remove comments 2023-04-01 18:30:27 +08:00
274a2b6733
docs: remove reference 2023-04-01 18:29:23 +08:00
8462362033
feat: add style to slashmenu 2023-04-01 18:27:16 +08:00
2852e44cde
refactor: use unplugin-vue-components 2023-04-01 16:24:04 +08:00
11 changed files with 822 additions and 652 deletions

View file

@ -1,6 +1,6 @@
# Introduction # Introduction
A Pleroma/Mastodon client, focus on editing experience (WIP 🏗️), developed by [@seviche@kongwoo.icu](https://kongwoo.icu/seviche) A Pleroma/Mastodon client, focus on editing experience (WIP 🏗️)
- [Codeberg](https://codeberg.org/Sevichecc/Seigwai) - [Codeberg](https://codeberg.org/Sevichecc/Seigwai)
- [Github](https://github.com/Sevichecc/Seigwai) - [Github](https://github.com/Sevichecc/Seigwai)

16
components.d.ts vendored Normal file
View file

@ -0,0 +1,16 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
BubbleMenu: typeof import('./src/components/tiptap/BubbleMenu.vue')['default']
CommandsList: typeof import('./src/components/tiptap/CommandsList.vue')['default']
Editor: typeof import('./src/components/tiptap/Editor.vue')['default']
}
}

View file

@ -11,22 +11,20 @@
"prepare": "husky install" "prepare": "husky install"
}, },
"dependencies": { "dependencies": {
"@egoist/tailwindcss-icons": "^1.0.7", "@prosemirror-adapter/vue": "^0.2.4",
"@prosemirror-adapter/vue": "^0.2.3", "@tiptap/core": "^2.0.1",
"@tiptap/core": "2.0.0-beta.220", "@tiptap/extension-bubble-menu": "^2.0.1",
"@tiptap/extension-bubble-menu": "2.0.0-beta.220",
"@tiptap/extension-bullet-list": "^2.0.1", "@tiptap/extension-bullet-list": "^2.0.1",
"@tiptap/extension-character-count": "2.0.0-beta.220", "@tiptap/extension-character-count": "^2.0.1",
"@tiptap/extension-code-block-lowlight": "^2.0.1", "@tiptap/extension-code-block-lowlight": "^2.0.1",
"@tiptap/extension-highlight": "^2.0.0", "@tiptap/extension-highlight": "^2.0.1",
"@tiptap/extension-link": "2.0.0-beta.220", "@tiptap/extension-link": "^2.0.1",
"@tiptap/extension-placeholder": "^2.0.1", "@tiptap/extension-placeholder": "^2.0.1",
"@tiptap/extension-typography": "2.0.0-beta.220", "@tiptap/extension-typography": "^2.0.1",
"@tiptap/pm": "2.0.0-beta.220", "@tiptap/pm": "^2.0.1",
"@tiptap/starter-kit": "2.0.0-beta.220", "@tiptap/starter-kit": "^2.0.1",
"@tiptap/suggestion": "^2.0.0", "@tiptap/suggestion": "^2.0.1",
"@tiptap/vue-3": "2.0.0-beta.220", "@tiptap/vue-3": "^2.0.1",
"daisyui": "^2.51.5",
"highlight.js": "^11.7.0", "highlight.js": "^11.7.0",
"lowlight": "^2.8.1", "lowlight": "^2.8.1",
"masto": "^5.10.0", "masto": "^5.10.0",
@ -35,17 +33,20 @@
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^0.37.0", "@antfu/eslint-config": "^0.37.0",
"@iconify-json/tabler": "^1.1.68", "@egoist/tailwindcss-icons": "^1.0.7",
"@iconify-json/tabler": "^1.1.70",
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
"@vitejs/plugin-vue": "^4.1.0", "@vitejs/plugin-vue": "^4.1.0",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
"eslint": "^8.36.0", "daisyui": "^2.51.5",
"eslint": "^8.37.0",
"husky": "^8.0.3", "husky": "^8.0.3",
"lint-staged": "^13.2.0", "lint-staged": "^13.2.0",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"sass": "^1.60.0", "sass": "^1.60.0",
"tailwindcss": "^3.3.1", "tailwindcss": "^3.3.1",
"typescript": "^5.0.3", "typescript": "^5.0.3",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.1", "vite": "^4.2.1",
"vue-tsc": "^1.2.0" "vue-tsc": "^1.2.0"
}, },

File diff suppressed because it is too large Load diff

View file

@ -3,13 +3,13 @@
import { VueRenderer } from '@tiptap/vue-3' import { VueRenderer } from '@tiptap/vue-3'
import tippy from 'tippy.js' import tippy from 'tippy.js'
import CommandsList from './CommandsList.vue' import CommandsList from '../../components/tiptap/CommandsList.vue'
export default { export default {
items: ({ query }) => { items: ({ query }) => {
return [ return [
{ {
title: 'H1', title: 'Heading 1',
icon: 'i-tabler-h-1', icon: 'i-tabler-h-1',
command: ({ editor, range }) => { command: ({ editor, range }) => {
editor editor
@ -21,7 +21,7 @@ export default {
}, },
}, },
{ {
title: 'H2', title: 'Heading 2',
icon: 'i-tabler-h-2', icon: 'i-tabler-h-2',
command: ({ editor, range }) => { command: ({ editor, range }) => {
editor editor
@ -33,7 +33,7 @@ export default {
}, },
}, },
{ {
title: 'H3', title: 'Heading 3',
icon: 'i-tabler-h-3', icon: 'i-tabler-h-3',
command: ({ editor, range }) => { command: ({ editor, range }) => {
editor editor

View file

@ -1,7 +1,3 @@
<script setup lang="ts">
import Editor from './components/Tiptap/Editor.vue'
</script>
<template> <template>
<Editor /> <Editor />
</template> </template>

View file

@ -69,52 +69,15 @@ export default {
</script> </script>
<template> <template>
<div class="items"> <div v-if="items.length" class="menu menu-compact bg-white w-44 p-1 rounded-lg shadow-lg border-slate-200 border ">
<template v-if="items.length"> <li
<div
v-for="(item, index) in items" v-for="(item, index) in items"
:key="index" :key="index"
class="item" class="rounded-lg"
:class="{ 'is-selected': index === selectedIndex }" :class="{ 'active bg-slate-200': index === selectedIndex }"
@click="selectItem(index)" @click="selectItem(index)"
> >
<span :class="item.icon" /> <a class="hover:bg-slate-200 text-slate-900 active:bg-slate-300"><span :class="item.icon" class="h-4 w-4" />{{ item.title }}</a>
{{ item.title }} </li>
</div>
</template>
<div v-else class="item">
No result
</div>
</div> </div>
</template> </template>
<style lang="scss">
.items {
padding: 0.2rem;
position: relative;
border-radius: 0.5rem;
background: #FFF;
color: rgba(0, 0, 0, 0.8);
overflow: hidden;
font-size: 0.9rem;
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.05),
0px 10px 20px rgba(0, 0, 0, 0.1),
;
}
.item {
display: block;
margin: 0;
width: 100%;
text-align: left;
background: transparent;
border-radius: 0.4rem;
border: 1px solid transparent;
padding: 0.2rem 0.4rem;
&.is-selected {
border-color: #000;
}
}
</style>

View file

@ -20,9 +20,8 @@ import scss from 'highlight.js/lib/languages/scss'
import go from 'highlight.js/lib/languages/go' import go from 'highlight.js/lib/languages/go'
import rust from 'highlight.js/lib/languages/rust' import rust from 'highlight.js/lib/languages/rust'
import suggestion from './suggestion' import Commands from '../../ composables/tiptap/commands'
import BubbleMenu from './BubbleMenu.vue' import suggestion from '../../ composables/tiptap/suggestion'
import Commands from './commands'
lowlight.registerLanguage('html', html) lowlight.registerLanguage('html', html)
lowlight.registerLanguage('css', css) lowlight.registerLanguage('css', css)
@ -75,8 +74,6 @@ const editor = useEditor({
}, },
}), }),
Placeholder.configure({ Placeholder.configure({
// Use different placeholders depending on the node type:
// placeholder: 'Write something '
placeholder: ({ node }) => { placeholder: ({ node }) => {
if (node.type.name === 'heading') { if (node.type.name === 'heading') {
switch (node.attrs.level) { switch (node.attrs.level) {
@ -108,13 +105,6 @@ const editor = useEditor({
</template> </template>
<style lang="scss"> <style lang="scss">
/* Basic editor styles */
.ProseMirror {
> * + * {
margin-top: 0.75em;
}
}
/* Placeholder (at the top) */ /* Placeholder (at the top) */
.ProseMirror p.is-editor-empty:first-child::before { .ProseMirror p.is-editor-empty:first-child::before {
content: attr(data-placeholder); content: attr(data-placeholder);

View file

@ -13,4 +13,7 @@ export default {
collections: getIconCollections(['tabler']), collections: getIconCollections(['tabler']),
}), }),
], ],
daisyui: {
themes: false,
},
} satisfies Config } satisfies Config

View file

@ -1,5 +1,6 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import tailwindcss from 'tailwindcss' import tailwindcss from 'tailwindcss'
import autoprefixer from 'autoprefixer' import autoprefixer from 'autoprefixer'
import tailwindConfig from './tailwind.config' import tailwindConfig from './tailwind.config'
@ -11,5 +12,10 @@ export default defineConfig({
plugins: [tailwindcss(tailwindConfig), autoprefixer()], plugins: [tailwindcss(tailwindConfig), autoprefixer()],
}, },
}, },
plugins: [vue()], plugins: [
vue(),
Components({
dts: true,
}),
],
}) })