You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					58 lines
				
				1.5 KiB
			
		
		
			
		
	
	
					58 lines
				
				1.5 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								'use strict';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Object.defineProperty(exports, '__esModule', { value: true });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var core = require('@tiptap/core');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const inputRegex = /^\s*>\s$/;
							 | 
						||
| 
								 | 
							
								const Blockquote = core.Node.create({
							 | 
						||
| 
								 | 
							
								    name: 'blockquote',
							 | 
						||
| 
								 | 
							
								    addOptions() {
							 | 
						||
| 
								 | 
							
								        return {
							 | 
						||
| 
								 | 
							
								            HTMLAttributes: {},
							 | 
						||
| 
								 | 
							
								        };
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    content: 'block+',
							 | 
						||
| 
								 | 
							
								    group: 'block',
							 | 
						||
| 
								 | 
							
								    defining: true,
							 | 
						||
| 
								 | 
							
								    parseHTML() {
							 | 
						||
| 
								 | 
							
								        return [
							 | 
						||
| 
								 | 
							
								            { tag: 'blockquote' },
							 | 
						||
| 
								 | 
							
								        ];
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    renderHTML({ HTMLAttributes }) {
							 | 
						||
| 
								 | 
							
								        return ['blockquote', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    addCommands() {
							 | 
						||
| 
								 | 
							
								        return {
							 | 
						||
| 
								 | 
							
								            setBlockquote: () => ({ commands }) => {
							 | 
						||
| 
								 | 
							
								                return commands.wrapIn(this.name);
							 | 
						||
| 
								 | 
							
								            },
							 | 
						||
| 
								 | 
							
								            toggleBlockquote: () => ({ commands }) => {
							 | 
						||
| 
								 | 
							
								                return commands.toggleWrap(this.name);
							 | 
						||
| 
								 | 
							
								            },
							 | 
						||
| 
								 | 
							
								            unsetBlockquote: () => ({ commands }) => {
							 | 
						||
| 
								 | 
							
								                return commands.lift(this.name);
							 | 
						||
| 
								 | 
							
								            },
							 | 
						||
| 
								 | 
							
								        };
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    addKeyboardShortcuts() {
							 | 
						||
| 
								 | 
							
								        return {
							 | 
						||
| 
								 | 
							
								            'Mod-Shift-b': () => this.editor.commands.toggleBlockquote(),
							 | 
						||
| 
								 | 
							
								        };
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    addInputRules() {
							 | 
						||
| 
								 | 
							
								        return [
							 | 
						||
| 
								 | 
							
								            core.wrappingInputRule({
							 | 
						||
| 
								 | 
							
								                find: inputRegex,
							 | 
						||
| 
								 | 
							
								                type: this.type,
							 | 
						||
| 
								 | 
							
								            }),
							 | 
						||
| 
								 | 
							
								        ];
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								exports.Blockquote = Blockquote;
							 | 
						||
| 
								 | 
							
								exports["default"] = Blockquote;
							 | 
						||
| 
								 | 
							
								exports.inputRegex = inputRegex;
							 | 
						||
| 
								 | 
							
								//# sourceMappingURL=tiptap-extension-blockquote.cjs.map
							 |