Socket
Socket
Sign inDemoInstall

@tiptap/extension-code

Package Overview
Dependencies
Maintainers
5
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tiptap/extension-code - npm Package Compare versions

Comparing version 3.0.0-next.0 to 3.0.0-next.1

dist/index.d.cts

138

dist/index.js

@@ -1,70 +0,72 @@

import { Mark, mergeAttributes, markInputRule, markPasteRule } from '@tiptap/core';
/**
* Matches inline code.
*/
const inputRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/;
/**
* Matches inline code while pasting.
*/
const pasteRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g;
/**
* This extension allows you to mark text as inline code.
* @see https://tiptap.dev/api/marks/code
*/
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,
}),
];
},
// src/code.ts
import {
Mark,
markInputRule,
markPasteRule,
mergeAttributes
} from "@tiptap/core";
var inputRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/;
var pasteRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g;
var 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
// src/index.ts
var src_default = Code;
export {
Code,
src_default as default,
inputRegex,
pasteRegex
};
//# sourceMappingURL=index.js.map
{
"name": "@tiptap/extension-code",
"description": "code extension for tiptap",
"version": "3.0.0-next.0",
"version": "3.0.0-next.1",
"homepage": "https://tiptap.dev",

@@ -18,3 +18,3 @@ "keywords": [

".": {
"types": "./dist/packages/extension-code/src/index.d.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js",

@@ -26,4 +26,3 @@ "require": "./dist/index.cjs"

"module": "dist/index.js",
"umd": "dist/index.umd.js",
"types": "dist/packages/extension-code/src/index.d.ts",
"types": "dist/index.d.ts",
"files": [

@@ -34,6 +33,6 @@ "src",

"devDependencies": {
"@tiptap/core": "^3.0.0-next.0"
"@tiptap/core": "^3.0.0-next.1"
},
"peerDependencies": {
"@tiptap/core": "^3.0.0-next.0"
"@tiptap/core": "^3.0.0-next.1"
},

@@ -46,5 +45,4 @@ "repository": {

"scripts": {
"clean": "rm -rf dist",
"build": "npm run clean && rollup -c"
"build": "tsup"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc