@finalsite/rich-text-editor
在nativescript中进行所见即所得编辑
npm i --save @finalsite/rich-text-editor

@finalsite/rich-text-editor

ns plugin add @finalsite/rich-text-editor

安装

将资源文件夹复制到您的项目中。如果您只想使用contenteditable或ckeditor4中的一个,可以选择只复制其中一个文件。为了避免将来更新时更新这些文件,请避免更新这些文件。(js文件是将按钮命令与所选编辑器桥接的代码,而html文件则设置webview中的编辑器。)

对于NS8

将以下内容添加到您的 webpack.config.js

  webpack.Utils.addCopyRule({
from: '@finalsite/rich-text-editor/assets/html/default.html',
to: 'assets/html',
context: webpack.Utils.project.getProjectFilePath('node_modules'),
});

webpack.Utils.addCopyRule({
from: '@finalsite/rich-text-editor/assets/js/contenteditable.js',
to: 'assets/js',
context: webpack.Utils.project.getProjectFilePath('node_modules'),
});

对于NS7

例如

cp node_modules/@finalsite/rich-text-editor/assets/html/contenteditable.html app/assets/html/
cp node_modules/@finalsite/rich-text-editor/assets/js/contenteditable.js app/assets/js/

使用默认图标集

cp node_modules/@finalsite/rich-text-editor/fonts/MaterialIcons-Regular.ttf app/fonts/

并包含css文件

@import '~@finalsite/rich-text-editor/css/default.css';

目标

  • 提供具有包含contenteditable的webview的html编辑的本地UI
  • 灵活,可用于其他WYSIWIG编辑器(CKEditor,tinyMCE)
  • 可访问

使用(核心)

重要 为了正确显示工具栏,您必须使用GridLayout或RootLayout作为根布局

请参阅示例以了解使用方法

使用(Angular)

// TODO

依赖/致谢

依赖于https://github.com/Notalib/nativescript-webview-ext以与webview通信

许可证

Apache许可证版本2.0