Skip to content

Copy/Paste from source(MS Word) to the editor does not keep the format #590

@iDcodes

Description

@iDcodes

Hi, can anyone help me with my issue in keeping the format from source like MS Word to paste in the editor? When I am using the demo it does keep the format but when I pasted it on my version its not working.

Here's my code:

  • web.html
    <angular-editor id="editor" [(ngModel)]="htmlContent" [config]="editorConfig">
  • web.ts
    import { Component, OnInit } from '@angular/core';
    import { FormsModule } from '@angular/forms';
    import { AngularEditorModule, AngularEditorConfig } from '@kolkov/angular-editor';

@component({
selector: 'app-web-editor',
standalone: true,
imports: [FormsModule, AngularEditorModule, ReactiveFormsModule],
templateUrl: './web-editor.html',
styleUrls: ['./web-editor.css'],
})
export class WebEditor implements OnInit {
htmlContent = '';
title = 'WebEditor';

editorConfig: AngularEditorConfig = {
editable: true,
spellcheck: true,
minHeight: '5rem',
maxHeight: '15rem',
placeholder: 'Enter text here...',
translate: 'no',
sanitize: false,
outline: true,
defaultFontName: 'Comic Sans MS',
defaultFontSize: '5',
defaultParagraphSeparator: 'p',
customClasses: [
{ name: 'quote', class: 'quote' },
{ name: 'redText', class: 'redText' },
{ name: 'titleText', class: 'titleText', tag: 'h1' },
],
toolbarHiddenButtons: [['bold', 'italic']],
};

ngOnInit() {
console.log(this.htmlContent);
}
}

and below is the image of my version with the pasted text which should have the format from the source.

Image

and here's the version of my angular:
"dependencies": {
"@angular/cdk": "^21.0.3",
"@angular/common": "^21.0.6",
"@angular/compiler": "^21.0.6",
"@angular/core": "^21.0.6",
"@angular/forms": "^21.0.6",
"@angular/platform-browser": "^21.0.6",
"@angular/router": "^21.0.6",
"@kolkov/angular-editor": "^3.0.4"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions