doccraft 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/dist/blocks/base-styles.d.ts +6 -0
- package/dist/blocks/for-block/extension.d.ts +16 -0
- package/dist/blocks/for-block/index.d.ts +2 -0
- package/dist/blocks/for-block/styles.d.ts +2 -0
- package/dist/blocks/for-block/view.d.ts +2 -0
- package/dist/blocks/if-block/extension.d.ts +11 -0
- package/dist/blocks/if-block/index.d.ts +2 -0
- package/dist/blocks/if-block/styles.d.ts +2 -0
- package/dist/blocks/if-block/view.d.ts +2 -0
- package/dist/blocks/index.d.ts +5 -0
- package/dist/blocks/readonly-block/extension.d.ts +12 -0
- package/dist/blocks/readonly-block/index.d.ts +2 -0
- package/dist/blocks/readonly-block/styles.d.ts +2 -0
- package/dist/blocks/readonly-block/view.d.ts +2 -0
- package/dist/blocks/types.d.ts +47 -0
- package/dist/canvas/HeaderFooterField.d.ts +11 -0
- package/dist/canvas/PageCanvas.d.ts +16 -0
- package/dist/canvas/canvas-config.d.ts +25 -0
- package/dist/core/DocCraft.d.ts +54 -0
- package/dist/core/page-flow-plugin.d.ts +22 -0
- package/dist/core/use-editor.d.ts +14 -0
- package/dist/doccraft.cjs +1006 -0
- package/dist/doccraft.cjs.map +1 -0
- package/dist/doccraft.css +2 -0
- package/dist/doccraft.js +53090 -0
- package/dist/doccraft.js.map +1 -0
- package/dist/extensions/TemplateVariableView.d.ts +2 -0
- package/dist/extensions/page-break.d.ts +9 -0
- package/dist/extensions/paste-handler.d.ts +14 -0
- package/dist/extensions/resizable-image.d.ts +15 -0
- package/dist/extensions/template-variable.d.ts +21 -0
- package/dist/hooks/use-block-styles.d.ts +7 -0
- package/dist/image/HfResizableImage.d.ts +2 -0
- package/dist/image/ImageCropOverlay.d.ts +14 -0
- package/dist/image/ImageNodeView.d.ts +2 -0
- package/dist/index.d.ts +13 -0
- package/dist/pdf-C0490ZCf.js +15393 -0
- package/dist/pdf-C0490ZCf.js.map +1 -0
- package/dist/pdf-DDIBR0qz.cjs +12 -0
- package/dist/pdf-DDIBR0qz.cjs.map +1 -0
- package/dist/table/TableControls.d.ts +6 -0
- package/dist/toolbar/BubbleToolbar.d.ts +6 -0
- package/dist/toolbar/EditorActions.d.ts +25 -0
- package/dist/toolbar/EditorToolbar.d.ts +17 -0
- package/dist/toolbar/toolbar-config.d.ts +3 -0
- package/dist/types.d.ts +35 -0
- package/dist/ui/button.d.ts +8 -0
- package/dist/ui/card.d.ts +11 -0
- package/dist/ui/dialog.d.ts +17 -0
- package/dist/ui/dropdown-menu.d.ts +29 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/label.d.ts +3 -0
- package/dist/ui/popover.d.ts +9 -0
- package/dist/ui/separator.d.ts +3 -0
- package/dist/ui/toggle-group.d.ts +10 -0
- package/dist/ui/toggle.d.ts +8 -0
- package/dist/ui/tooltip.d.ts +6 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/export-html.d.ts +39 -0
- package/dist/utils/image-utils.d.ts +8 -0
- package/dist/utils/import-docx.d.ts +20 -0
- package/dist/utils/import-pdf.d.ts +19 -0
- package/package.json +93 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced paste handler that preserves formatting from Google Docs,
|
|
4
|
+
* Word, and other rich text editors.
|
|
5
|
+
*
|
|
6
|
+
* Strategy:
|
|
7
|
+
* - For Google Docs: resolve class-based styles to inline/semantic HTML,
|
|
8
|
+
* then let TipTap parse the enriched HTML.
|
|
9
|
+
* - For Word: Word already uses semantic HTML tags (<b>, <i>, <table>),
|
|
10
|
+
* so we let TipTap handle it natively.
|
|
11
|
+
* - For plain text / unknown sources: let TipTap handle natively.
|
|
12
|
+
* - For pasted images: convert to base64 and insert as resizableImage.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PasteHandler: Extension<any, any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
declare module '@tiptap/core' {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
resizableImage: {
|
|
5
|
+
setImage: (options: {
|
|
6
|
+
src: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
width?: number;
|
|
10
|
+
alignment?: string;
|
|
11
|
+
}) => ReturnType;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare const ResizableImage: Node<any, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import type { TemplateVariable as TemplateVariableType } from '../types';
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
templateVariable: {
|
|
6
|
+
insertVariable: (name: string) => ReturnType;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export interface TemplateVariableOptions {
|
|
11
|
+
/** Predefined variables available in the editor */
|
|
12
|
+
variables: TemplateVariableType[];
|
|
13
|
+
/** Whether users can add custom variables beyond the predefined list */
|
|
14
|
+
allowCustom: boolean;
|
|
15
|
+
/** The syntax wrapper — default is handlebars {{ }} */
|
|
16
|
+
syntax: {
|
|
17
|
+
open: string;
|
|
18
|
+
close: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const TemplateVariable: Node<TemplateVariableOptions, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EditorBlockPlugin } from '../blocks/types';
|
|
2
|
+
/**
|
|
3
|
+
* Injects block CSS styles into the document <head>.
|
|
4
|
+
* Each block owns its own styles. This hook collects them all,
|
|
5
|
+
* creates a single <style> element, and cleans up on unmount.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useBlockStyles(blocks: EditorBlockPlugin[]): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface CropArea {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
interface ImageCropOverlayProps {
|
|
8
|
+
imageWidth: number;
|
|
9
|
+
imageHeight: number;
|
|
10
|
+
onCrop: (crop: CropArea) => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function ImageCropOverlay({ imageWidth, imageHeight, onCrop, onCancel }: ImageCropOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './editor.css';
|
|
2
|
+
export { DocCraft } from './core/DocCraft';
|
|
3
|
+
export type { DocCraftRef, DocCraftProps } from './core/DocCraft';
|
|
4
|
+
export type { EditorActionsConfig } from './toolbar/EditorActions';
|
|
5
|
+
export { exportToPdfHtml, exportToPreviewHtml, exportToHtml } from './utils/export-html';
|
|
6
|
+
export { importDocx } from './utils/import-docx';
|
|
7
|
+
export { importPdf } from './utils/import-pdf';
|
|
8
|
+
export type { EditorBlockPlugin } from './blocks/types';
|
|
9
|
+
export { forBlock, ifBlock, readonlyBlock } from './blocks';
|
|
10
|
+
export type { CanvasConfig, ToolbarConfig, ToolbarFeature, TemplateVariable, ThemeConfig, ExtensionsConfig } from './types';
|
|
11
|
+
export { CANVAS_PRESETS, resolveCanvas } from './canvas/canvas-config';
|
|
12
|
+
export type { ResolvedCanvas } from './canvas/canvas-config';
|
|
13
|
+
export { TOOLBAR_PRESETS, resolveToolbar } from './toolbar/toolbar-config';
|