Skip to content

Commit

Permalink
added config for gh-pages, fixed a couple of bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sereneinserenade committed Aug 14, 2023
1 parent 5a0f365 commit dbb1754
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: sereneinserenade
43 changes: 43 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Shipp it baby

on:
push:
branches:
- main

jobs:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Setup Node 18
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Gimme node_modules Cache
working-directory: react-demo
uses: actions/cache@v3
id: gimme_cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
working-directory: react-demo
if: steps.gimme_cache.outputs.cache-hit == false
run: npm install

- name: Build 🔧
working-directory: react-demo
run: npm run build

- name: Deploy 🚀
working-directory: react-demo
uses: JamesIves/github-pages-deploy-action@v4.3.0
with:
branch: gh-pages # The branch the action should deploy to.
folder: dist # The folder the action should deploy.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ const editor = new Editor(
color: #999;
}
```


2 changes: 1 addition & 1 deletion react-demo/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
ignorePatterns: ['dist', '.eslintrc.cjs', '..'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
Expand Down
11 changes: 6 additions & 5 deletions react-demo/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import path from "path"
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({ mode }) => ({
plugins: [react()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
})
base: mode === "production" ? "/tiptap-inline-suggestion/" : "/",
}));
17 changes: 3 additions & 14 deletions src/inlineSuggestion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ export interface InlineSuggestionStorage {
};
}

const chunkString = (str: string): string[] => {
const words = str.split(" ");
const chunks = [];

for (let i = 0; i < words.length; i += 5) {
chunks.push(words.slice(i, i + 5).join(" "));
}

return chunks;
};

export const InlineSuggestion = Extension.create<
InlineSuggestionOptions,
InlineSuggestionStorage
Expand All @@ -54,7 +43,7 @@ export const InlineSuggestion = Extension.create<

addOptions() {
return {
fetchAutocompletion: async (existingText: string) => {
fetchAutocompletion: async () => {
const message =
"[@sereneinserenade/tiptap-inline-suggestions] Please add a fetchSuggestion function to fetch suggestions from.";

Expand All @@ -80,7 +69,7 @@ export const InlineSuggestion = Extension.create<
return chain()
.command(() => {
const chunkifiedSuggestion =
this.storage.data.currentSuggestion.split("");
this.storage.data.currentSuggestion!.split("");

this.storage.data = {};

Expand Down Expand Up @@ -166,7 +155,7 @@ export const InlineSuggestion = Extension.create<
decorations(state) {
return this.getState(state);
},
handleKeyDown(view, event) {
handleKeyDown(_, event) {
if (event.key === "Tab") {
event.preventDefault();

Expand Down

0 comments on commit dbb1754

Please sign in to comment.