Skip to content

Commit

Permalink
feat: drop tiptap image extension favor own
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Jun 6, 2024
1 parent 33fb1b0 commit f223301
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
3 changes: 0 additions & 3 deletions projects/demo/src/app/pages/anchors/examples/1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ import {
deps: [Injector],
useFactory: (injector: Injector) => [
import('@tbank/tui-editor').then(({TuiStarterKit}) => TuiStarterKit),
import('@tiptap/extension-image').then(({default: Image}) =>
Image.configure({inline: true, allowBase64: true}),
),
import('@tbank/tui-editor').then(({tuiCreateImageEditorExtension}) =>
tuiCreateImageEditorExtension({injector}),
),
Expand Down
3 changes: 0 additions & 3 deletions projects/demo/src/app/pages/images/upload/examples/1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ import {ImgbbService} from './imgbb.service';
import('@tbank/tui-editor').then(({tuiCreateImageEditorExtension}) =>
tuiCreateImageEditorExtension({injector}),
),
import('@tiptap/extension-image').then(({default: Image}) =>
Image.configure({inline: true, allowBase64: true}),
),
],
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type {OnInit} from '@angular/core';
import type {Injector, OnInit} from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
DestroyRef,
inject,
INJECTOR,
ViewChild,
} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
Expand Down Expand Up @@ -38,10 +39,11 @@ const markdown = `# h1 Heading 😎
providers: [
{
provide: TUI_EDITOR_EXTENSIONS,
useValue: [
deps: [INJECTOR],
useFactory: (injector: Injector) => [
import('@tiptap/starter-kit').then(({StarterKit}) => StarterKit),
import('@tiptap/extension-image').then(({Image}) =>
Image.configure({inline: true}),
import('@tbank/tui-editor').then(({tuiCreateImageEditorExtension}) =>
tuiCreateImageEditorExtension({injector}),
),
import('@tbank/tui-editor').then(({TuiMarkdown}) =>
TuiMarkdown.configure({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ import {
Input,
Output,
} from '@angular/core';
import {tuiIsNumber, tuiPx, TuiResizerDirective} from '@taiga-ui/cdk';
import {
tuiIsNumber,
tuiPx,
TuiResizeableDirective,
TuiResizerDirective,
} from '@taiga-ui/cdk';

@Component({
standalone: true,
selector: 'tui-editor-resizable',
imports: [TuiResizerDirective, NgIf],
imports: [TuiResizerDirective, NgIf, TuiResizeableDirective],
templateUrl: './editor-resizable.component.html',
styleUrls: ['./editor-resizable.component.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export const TUI_EDITOR_DEFAULT_EXTENSIONS: ReadonlyArray<
import('@tiptap/extension-subscript').then(({Subscript}) => Subscript),
import('@tiptap/extension-superscript').then(({Superscript}) => Superscript),
TuiFontColor,
import('@tiptap/extension-image').then(({default: Image}) =>
Image.configure({inline: true, allowBase64: true}),
),
TuiLink,
TuiJumpAnchor,
TuiFileLink,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function tuiCreateImageEditorExtension<T, K>({
const enableDraggable = tuiIsPresent(draggable) ? draggable : true;

return Image.extend({
name: 'imageEditor',
name: 'image',
group: 'inline',
inline: true,
atom: true,
Expand Down
18 changes: 9 additions & 9 deletions projects/editor/src/extensions/tiptap-node-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ export class TuiComponentRenderer<C, P> {
* It contains compulsory properties which component will get externally while NodeView's rendering.
*/
export class TuiNodeViewNg implements NodeViewProps {
public editor!: NodeViewProps['editor'];
public node!: NodeViewProps['node'];
public decorations!: NodeViewProps['decorations'];
public selected!: NodeViewProps['selected'];
public extension!: NodeViewProps['extension'];
public getPos!: NodeViewProps['getPos'];
public updateAttributes!: NodeViewProps['updateAttributes'];
public deleteNode!: NodeViewProps['deleteNode'];
public declare editor: NodeViewProps['editor'];
public declare node: NodeViewProps['node'];
public declare decorations: NodeViewProps['decorations'];
public declare selected: NodeViewProps['selected'];
public declare extension: NodeViewProps['extension'];
public declare getPos: NodeViewProps['getPos'];
public declare updateAttributes: NodeViewProps['updateAttributes'];
public declare deleteNode: NodeViewProps['deleteNode'];
}

export interface TuiNodeViewRendererOptions extends NodeViewRendererOptions {
Expand All @@ -96,7 +96,7 @@ export class TuiNodeView extends NodeView<
Editor,
TuiNodeViewRendererOptions
> {
protected renderer!: TuiComponentRenderer<TuiNodeViewNg, NodeViewProps>;
protected declare renderer: TuiComponentRenderer<TuiNodeViewNg, NodeViewProps>;
protected contentDOMElement: HTMLElement | null = null;

/**
Expand Down

0 comments on commit f223301

Please sign in to comment.