mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
* wip * wip * wip3 * chore: utils * feat: add command * wip * fix: key duplicate * fix: move and check * fix: use react-use instead * fix: sidebar * chore: make dynamic * chore: tablet mode * chore: fix padding * chore: link instead of inbox * fix: use dnd kit * feat: add select component * chore: use atom * refactor: remove dnd provider * feat: disabled drag when sort is not manual * search route * . * feat: accessibility * fix: search * . * . * . * fix: sidebar collapsed * ai search layout * . * . * . * . * ai responsible content * . * . * . * . * . * global topic route * global topic correct route * topic buttons * sidebar search navigation * ai * Update jazz * . * . * . * . * . * learning status * . * . * chore: content header * fix: pointer none when dragging. prevent auto click after drag end * fix: confirm * fix: prevent drag when editing * chore: remove unused fn * fix: check propagation * chore: list * chore: tweak sonner * chore: update stuff * feat: add badge * chore: close edit when create * chore: escape on manage form * refactor: remove learn path * css: responsive item * chore: separate pages and topic * reafactor: remove new-schema * feat(types): extend jazz type so it can be nullable * chore: use new types * fix: missing deps * fix: link * fix: sidebar in layout * fix: quotes * css: use medium instead semi * Actual streaming and rendering markdown response * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * . * chore: metadata * feat: la-editor * . * fix: editor and page * . * . * . * . * . * . * fix: remove link * chore: page sidebar * fix: remove 'replace with learning status' * fix: link * fix: link * chore: update schema * chore: use new schema * fix: instead of showing error, just do unique slug * feat: create slug * refactor apply * update package json * fix: schema personal page * chore: editor * feat: pages * fix: metadata * fix: jazz provider * feat: handling data * feat: page detail * chore: server page to id * chore: use id instead of slug * chore: update content header * chore: update link header implementation * refactor: global.css * fix: la editor use animation frame * fix: editor export ref * refactor: page detail * chore: tidy up schema * chore: adapt to new schema * fix: wrap using settimeout * fix: wrap using settimeout * . * . --------- Co-authored-by: marshennikovaolga <marshennikova@gmail.com> Co-authored-by: Nikita <github@nikiv.dev> Co-authored-by: Anselm <anselm.eickhoff@gmail.com> Co-authored-by: Damian Tarnawski <gthetarnav@gmail.com>
154 lines
4.1 KiB
TypeScript
154 lines
4.1 KiB
TypeScript
import { Extension } from "@tiptap/core"
|
||
import { Bold, BoldOptions } from "@tiptap/extension-bold"
|
||
import { Document } from "@tiptap/extension-document"
|
||
import { Gapcursor } from "@tiptap/extension-gapcursor"
|
||
import { HardBreak, HardBreakOptions } from "@tiptap/extension-hard-break"
|
||
import { Italic, ItalicOptions } from "@tiptap/extension-italic"
|
||
import { ListItem, ListItemOptions } from "@tiptap/extension-list-item"
|
||
import { Strike, StrikeOptions } from "@tiptap/extension-strike"
|
||
import { Text } from "@tiptap/extension-text"
|
||
import { FocusClasses, FocusOptions } from "@tiptap/extension-focus"
|
||
import { Typography, TypographyOptions } from "@tiptap/extension-typography"
|
||
import { Placeholder, PlaceholderOptions } from "@tiptap/extension-placeholder"
|
||
import { History, HistoryOptions } from "@tiptap/extension-history"
|
||
|
||
export interface StarterKitOptions {
|
||
/**
|
||
* If set to false, the bold extension will not be registered
|
||
* @example bold: false
|
||
*/
|
||
bold: Partial<BoldOptions> | false
|
||
|
||
/**
|
||
* If set to false, the document extension will not be registered
|
||
* @example document: false
|
||
*/
|
||
document: false
|
||
|
||
/**
|
||
* If set to false, the gapcursor extension will not be registered
|
||
* @example gapcursor: false
|
||
*/
|
||
gapcursor: false
|
||
|
||
/**
|
||
* If set to false, the hardBreak extension will not be registered
|
||
* @example hardBreak: false
|
||
*/
|
||
hardBreak: Partial<HardBreakOptions> | false
|
||
|
||
/**
|
||
* If set to false, the history extension will not be registered
|
||
* @example history: false
|
||
*/
|
||
history: Partial<HistoryOptions> | false
|
||
|
||
/**
|
||
* If set to false, the italic extension will not be registered
|
||
* @example italic: false
|
||
*/
|
||
italic: Partial<ItalicOptions> | false
|
||
|
||
/**
|
||
* If set to false, the listItem extension will not be registered
|
||
* @example listItem: false
|
||
*/
|
||
listItem: Partial<ListItemOptions> | false
|
||
|
||
/**
|
||
* If set to false, the strike extension will not be registered
|
||
* @example strike: false
|
||
*/
|
||
strike: Partial<StrikeOptions> | false
|
||
|
||
/**
|
||
* If set to false, the text extension will not be registered
|
||
* @example text: false
|
||
*/
|
||
text: false
|
||
|
||
/**
|
||
* If set to false, the typography extension will not be registered
|
||
* @example typography: false
|
||
*/
|
||
typography: Partial<TypographyOptions> | false
|
||
|
||
/**
|
||
* If set to false, the placeholder extension will not be registered
|
||
* @example placeholder: false
|
||
*/
|
||
|
||
placeholder: Partial<PlaceholderOptions> | false
|
||
|
||
/**
|
||
* If set to false, the focus extension will not be registered
|
||
* @example focus: false
|
||
*/
|
||
focus: Partial<FocusOptions> | false
|
||
}
|
||
|
||
/**
|
||
* The starter kit is a collection of essential editor extensions.
|
||
*
|
||
* It’s a good starting point for building your own editor.
|
||
*/
|
||
export const StarterKit = Extension.create<StarterKitOptions>({
|
||
name: "starterKit",
|
||
|
||
addExtensions() {
|
||
const extensions = []
|
||
|
||
if (this.options.bold !== false) {
|
||
extensions.push(Bold.configure(this.options?.bold))
|
||
}
|
||
|
||
if (this.options.document !== false) {
|
||
extensions.push(Document.configure(this.options?.document))
|
||
}
|
||
|
||
if (this.options.gapcursor !== false) {
|
||
extensions.push(Gapcursor.configure(this.options?.gapcursor))
|
||
}
|
||
|
||
if (this.options.hardBreak !== false) {
|
||
extensions.push(HardBreak.configure(this.options?.hardBreak))
|
||
}
|
||
|
||
if (this.options.history !== false) {
|
||
extensions.push(History.configure(this.options?.history))
|
||
}
|
||
|
||
if (this.options.italic !== false) {
|
||
extensions.push(Italic.configure(this.options?.italic))
|
||
}
|
||
|
||
if (this.options.listItem !== false) {
|
||
extensions.push(ListItem.configure(this.options?.listItem))
|
||
}
|
||
|
||
if (this.options.strike !== false) {
|
||
extensions.push(Strike.configure(this.options?.strike))
|
||
}
|
||
|
||
if (this.options.text !== false) {
|
||
extensions.push(Text.configure(this.options?.text))
|
||
}
|
||
|
||
if (this.options.typography !== false) {
|
||
extensions.push(Typography.configure(this.options?.typography))
|
||
}
|
||
|
||
if (this.options.placeholder !== false) {
|
||
extensions.push(Placeholder.configure(this.options?.placeholder))
|
||
}
|
||
|
||
if (this.options.focus !== false) {
|
||
extensions.push(FocusClasses.configure(this.options?.focus))
|
||
}
|
||
|
||
return extensions
|
||
}
|
||
})
|
||
|
||
export default StarterKit
|