
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@kunalukey/tiptap-pagination-patch
Advanced tools
npm install @kunalukey/tiptap-pagination-patch
/**
* @file /src/Tiptap/Editor.tsx
* @name Editor
* @description Example Tiptap editor with pagination plugin.
*/
import React from "react";
import { Stack } from "@mui/material";
import { EditorContent, useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import PaginationExtension, { PageNode, HeaderFooterNode, BodyNode } from "@kunalukey/tiptap-pagination-patch";
type DispatchOrFunction<T> = Dispatch<T> | ((value: T) => void);
type EditorProps = {
content: string;
setContent: DispatchOrFunction<string>;
editable?: boolean;
};
const Editor: React.FC<EditorProps> = ({ content, setContent, editable = true }) => {
const extensions = [
StarterKit,
PaginationExtension.configure({ ... }), // See configuration options below.
PageNode,
HeaderFooterNode,
BodyNode];
const editor = useEditor({
extensions,
content,
onUpdate({ editor }) {
const editorContent = editor.getHTML();
handleChange(editorContent);
},
editable,
onSelectionUpdate({ editor }) {
const { state } = editor;
const { selection } = state;
const { $from, $to } = selection;
console.log("Selection updated:", $from.pos, $to.pos);
},
});
// ====== Event Handlers ======
/**
* Handles change in text.
*
* @param value - new text value
* @returns {void}
*/
const handleChange = (value: string): void => {
setContent(value);
};
// ====== Render ======
return (
<Stack direction="column" flexGrow={1} paddingX={2} overflow="auto">
<EditorContent editor={editor} />
</Stack>
);
};
export default Editor;
This extension comes with a number of configuration options to tailor the editor to your usage. If specified, these configuration options should be placed with the .configuration()
method when specifying the PaginationExtension
in your extension array. See below example.
defaultPaperSize: PaperSize
PaperSize
"A4"
"A3"
defaultPaperColour: string
string
"#fff"
"#f0f0f0"
useDeviceThemeForPaperColour: boolean
boolean
false
true | false
defaultPaperOrientation: PaperOrientation
PaperOrientation
"portrait"
"portrait" | "landscape"
defaultMarginConfig: MarginConfig
MarginConfig
{ top: 25.4, right: 25.4, bottom: 25.4, left: 25.4 }
{ top: 10, right: 10, bottom: 10, left: 10 }
defaultPageBorders: BorderConfig
BorderConfig
{ top: 1, right: 1, bottom: 1, left: 1 }
{ top: 2, right: 2, bottom: 2, left: 2 }
pageAmendmentOptions: PageAmendmentOptions
PageAmendmentOptions
{ enableHeader: true, enableFooter: false }
You can specify as little or as much of the configuration as you like. For example:
import PaginationExtension from "@kunalukey/tiptap-pagination-patch";
// Then in your extension array (within your component)
PaginationExtension.configure({
defaultPaperSize: "A3",
pageAmendmentOptions: {
enableHeader: false,
enableFooter: false,
},
}),
Improved from clemente-xyz's comment here in TipTap discussion #5719.
FAQs
Patch for Tiptap Pagination Extension
We found that @kunalukey/tiptap-pagination-patch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.