html - 从 ngx-editor 禁用特定项目
问题描述
我正在尝试从 ngx-editor 禁用特定项目,但它不起作用......
这是我的实际代码:
<app-ngx-editor [placeholder]="'Enter text here...'"
[enableToolbar]="true" [editable]="false"
[spellcheck]="true" [(ngModel)]="htmlContent"></app-ngx-editor>
当我设置“可编辑”=“假”时,工具栏的所有项目都被禁用......我怎样才能只禁用“视频”按钮?
解决方案
我遇到了一些问题。我找到解决方案
<app-ngx-editor [config]="editorConfig" [placeholder]="'Enter text here...'" [spellcheck]="true" [(ngModel)]="content"></app-ngx-editor>
在你的组件里面
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-new-job-offer',
templateUrl: './new-job-offer.component.html',
styleUrls: ['./new-job-offer.component.css']
})
export class NewJobOfferComponent implements OnInit {
content = '<h1>Hello2</h1>';
editorConfig = {
editable: true,
spellcheck: false,
height: '10rem',
minHeight: '5rem',
placeholder: 'Type something. Test the Editor... ヽ(^。^)丿',
translate: 'no',
"toolbar": [
["bold", "italic", "underline", "strikeThrough", "superscript", "subscript"],
["fontName", "fontSize", "color"],
["justifyLeft", "justifyCenter", "justifyRight", "justifyFull", "indent", "outdent"],
["cut", "copy", "delete", "removeFormat", "undo", "redo"],
["paragraph", "blockquote", "removeBlockquote", "horizontalLine", "orderedList", "unorderedList"],
["link", "unlink", "image", "video"]
]
};
constructor() { }
ngOnInit() {
}
}
请记住将 [config]="editorConfig" 添加到您的 html 代码中的 app-ngx-editor 中。
在工具栏部分可以禁用一些无用的图标;)
推荐阅读
- c# - 对一列求和但不断超时 LINQ
- c# - 时间转换器 C#
- html - 选择 tagName 组块 Gutenberg
- amazon-web-services - 如何将域*子目录*(不是子域)指向 AWS EC2 实例
- ios - iOS 使用 FFmpeg+libx264 构建 PJSIP
- php - 在两列中查找两个值
- swift - SwiftUI 小部件不刷新
- python - 在 x 轴上偏移绘图跟踪
- facebook-graph-api - share_open_graph 未采用动态 OG 标签链接或图像
- intellij-idea - 任何 JetBrains IDE:如何将 Ctrl + 鼠标滚轮映射到 Page Up/Down 操作?