REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.30 KB
Close
/home/byroehnu/easepaybiz.easetack.com/node_modules/@tiptap/extension-code/src/code.ts
Text
Base64
import { Mark, markInputRule, markPasteRule, mergeAttributes, } from '@tiptap/core' export interface CodeOptions { /** * The HTML attributes applied to the code element. * @default {} * @example { class: 'foo' } */ HTMLAttributes: Record<string, any>, } declare module '@tiptap/core' { interface Commands<ReturnType> { code: { /** * Set a code mark */ setCode: () => ReturnType, /** * Toggle inline code */ toggleCode: () => ReturnType, /** * Unset a code mark */ unsetCode: () => ReturnType, } } } /** * Regular expressions to match inline code blocks enclosed in backticks. * It matches: * - An opening backtick, followed by * - Any text that doesn't include a backtick (captured for marking), followed by * - A closing backtick. * This ensures that any text between backticks is formatted as code, * regardless of the surrounding characters (exception being another backtick). */ export const inputRegex = /(^|[^`])`([^`]+)`(?!`)/ /** * Matches inline code while pasting. */ export const pasteRegex = /(^|[^`])`([^`]+)`(?!`)/g /** * This extension allows you to mark text as inline code. * @see https://tiptap.dev/api/marks/code */ export const Code = Mark.create<CodeOptions>({ name: 'code', addOptions() { return { HTMLAttributes: {}, } }, excludes: '_', code: true, exitable: true, parseHTML() { return [ { tag: 'code' }, ] }, renderHTML({ HTMLAttributes }) { return ['code', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0] }, addCommands() { return { setCode: () => ({ commands }) => { return commands.setMark(this.name) }, toggleCode: () => ({ commands }) => { return commands.toggleMark(this.name) }, unsetCode: () => ({ commands }) => { return commands.unsetMark(this.name) }, } }, addKeyboardShortcuts() { return { 'Mod-e': () => this.editor.commands.toggleCode(), } }, addInputRules() { return [ markInputRule({ find: inputRegex, type: this.type, }), ] }, addPasteRules() { return [ markPasteRule({ find: pasteRegex, type: this.type, }), ] }, })
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 3
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.htaccess
127 B
lr--r--r--
2026-03-14 01:49:07
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
code.ts
2.30 KB
lrw-r--r--
2026-03-05 00:20:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.ts
81 B
lrw-r--r--
2026-03-05 00:20:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).