-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,196 additions
and
1,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
export * from './drop-cursor'; | ||
export * from './font-family'; | ||
export * from './gap-cursor'; | ||
export * from './history'; | ||
export * from './letter-spacing'; | ||
export * from './line-height'; | ||
export * from './node-id'; | ||
export * from './placeholder'; | ||
export * from './text-align'; |
47 changes: 0 additions & 47 deletions
47
apps/penxle.com/src/lib/tiptap/extensions/letter-spacing.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Extension } from '@tiptap/core'; | ||
import clsx from 'clsx'; | ||
import { Paragraph } from '$lib/tiptap/nodes'; | ||
import { LegacyHeading } from './heading'; | ||
|
||
const types = [LegacyHeading.name, Paragraph.name]; | ||
|
||
export const LegacyFontFamily = Extension.create({ | ||
name: 'legacy_font_family', | ||
|
||
addGlobalAttributes() { | ||
return [ | ||
{ | ||
types, | ||
attributes: { | ||
'font-family': { | ||
default: undefined, | ||
renderHTML: ({ 'font-family': fontFamily }) => ({ | ||
class: clsx( | ||
fontFamily === 'sans' && 'font-sans', | ||
fontFamily === 'serif' && 'font-serif', | ||
fontFamily === 'serif2' && 'font-serif2', | ||
fontFamily === 'serif3' && 'font-serif3', | ||
fontFamily === 'mono' && 'font-mono', | ||
), | ||
}), | ||
}, | ||
}, | ||
}, | ||
]; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { mergeAttributes, Node } from '@tiptap/core'; | ||
import clsx from 'clsx'; | ||
|
||
export const LegacyHeading = Node.create({ | ||
name: 'heading', | ||
group: 'block', | ||
content: 'text*', | ||
defining: true, | ||
|
||
addAttributes() { | ||
return { | ||
level: { | ||
renderHTML: ({ level }) => ({ | ||
class: clsx(level === 1 && 'title-24-b', level === 2 && 'title-20-b', level === 3 && 'subtitle-18-b'), | ||
}), | ||
}, | ||
}; | ||
}, | ||
|
||
renderHTML({ node, HTMLAttributes }) { | ||
return [`h${node.attrs.level}`, mergeAttributes(HTMLAttributes, { class: 'my-4' }), 0]; | ||
}, | ||
}); |
35 changes: 35 additions & 0 deletions
35
apps/penxle.com/src/lib/tiptap/legacies/horizontal-rule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { mergeAttributes, Node } from '@tiptap/core'; | ||
import clsx from 'clsx'; | ||
|
||
export const LegacyHorizontalRule = Node.create({ | ||
name: 'horizontalRule', | ||
group: 'block', | ||
|
||
addAttributes() { | ||
return { | ||
kind: { | ||
default: 1, | ||
renderHTML: ({ kind }) => ({ | ||
class: clsx( | ||
'bg-no-repeat border-none bg-center m-y-xs m-x-auto', | ||
kind === 1 && 'h-0.0625rem bg-repeat!', | ||
kind === 2 && 'border-1 border-solid border-current', | ||
kind === 3 && 'border-1 border-solid border-current w-7.5rem', | ||
kind === 4 && 'h-1.8rem bg-[url(/horizontal-rules/4.svg)]', | ||
kind === 5 && 'h-0.875rem bg-[url(/horizontal-rules/5.svg)]', | ||
kind === 6 && 'h-0.91027rem bg-[url(/horizontal-rules/6.svg)]', | ||
kind === 7 && 'h-1.25rem bg-[url(/horizontal-rules/7.svg)]', | ||
), | ||
style: | ||
kind === 1 | ||
? 'background-size: 16px 1px; background-image: linear-gradient(to right, currentColor 50%, rgb(255 255 255 / 0) 50%);' | ||
: undefined, | ||
}), | ||
}, | ||
}; | ||
}, | ||
|
||
renderHTML({ HTMLAttributes }) { | ||
return ['hr', mergeAttributes(HTMLAttributes, { class: 'bg-no-repeat border-none bg-center m-y-xs m-x-auto' })]; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export * from './font-family'; | ||
export * from './heading'; | ||
export * from './horizontal-rule'; | ||
export * from './letter-spacing'; | ||
export * from './line-height'; | ||
export * from './text-align'; | ||
export * from './text-color'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Extension } from '@tiptap/core'; | ||
import clsx from 'clsx'; | ||
import { Paragraph } from '$lib/tiptap/nodes'; | ||
import { LegacyHeading } from './heading'; | ||
|
||
// value reference from classname: https://tailwindcss.com/docs/letter-spacing | ||
const types = [LegacyHeading.name, Paragraph.name]; | ||
|
||
export const LegacyLetterSpacing = Extension.create({ | ||
name: 'legacy_letter_spacing', | ||
|
||
addGlobalAttributes() { | ||
return [ | ||
{ | ||
types, | ||
attributes: { | ||
'letter-spacing': { | ||
default: undefined, | ||
renderHTML: ({ 'letter-spacing': letterSpacing }) => ({ | ||
class: clsx( | ||
letterSpacing === 'tighter' && 'tracking-tighter', | ||
letterSpacing === 'tight' && 'tracking-tight', | ||
letterSpacing === 'normal' && 'tracking-normal', | ||
letterSpacing === 'wide' && 'tracking-wide', | ||
letterSpacing === 'wider' && 'tracking-wider', | ||
letterSpacing === 'widest' && 'tracking-widest', | ||
), | ||
}), | ||
}, | ||
}, | ||
}, | ||
]; | ||
}, | ||
}); |
Oops, something went wrong.