PHP 8.2.30
Preview: index.js Size: 1.58 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/@tiptap/extension-code/dist/index.js

import { Mark, mergeAttributes, markInputRule, markPasteRule } from '@tiptap/core';

const inputRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/;
const pasteRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g;
const Code = Mark.create({
    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,
            }),
        ];
    },
});

export { Code, Code as default, inputRegex, pasteRegex };
//# sourceMappingURL=index.js.map

Directory Contents

Dirs: 1 × Files: 6

Name Size Perms Modified Actions
packages DIR
- drwxr-xr-x 2026-02-28 00:27:44
Edit Download
1.68 KB lrw-r--r-- 2026-02-28 00:26:36
Edit Download
3.12 KB lrw-r--r-- 2026-02-28 00:27:14
Edit Download
1.58 KB lrw-r--r-- 2026-02-28 00:26:46
Edit Download
3.05 KB lrw-r--r-- 2026-02-28 00:27:26
Edit Download
2.17 KB lrw-r--r-- 2026-02-28 00:26:54
Edit Download
3.13 KB lrw-r--r-- 2026-02-28 00:27:34
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).