w8tcha/ckeditor-wordcount-plugin
Composer 安装命令:
composer require w8tcha/ckeditor-wordcount-plugin
包简介
WordCount Plugin for CKEditor Editor
README 文档
README
WordCount Plugin for CKEditor v4 that counts the words/characters and shows the word count and/or char count in the footer of the editor.
Demo
http://w8tcha.github.io/CKEditor-WordCount-Plugin/
DISCLAIMER: This is a forked Version, I can not find the original Author anymore if anyone knows the original Author please contact me and I can include the Author in the Copyright Notices.
License
Licensed under the terms of the MIT License.
Installation
If building a new editor using the CKBuilder from http://ckeditor.com/, there is no need to follow numbers steps below. If adding the Word Count & Char Count plugin to an already established CKEditor, follow the numbered steps below.
- Download the Word Count & Char Count plugin from http://ckeditor.com/addon/wordcount or https://github.com/w8tcha/CKEditor-WordCount-Plugin. This will download a folder named wordcount_version.zip or CKEditor-WordCount-Plugin-master.zip to your Downloads folder.
- Download the Notification plugin from http://ckeditor.com/addon/notification. This will download a folder named notification_version.zip to your Downloads folder.
- Extract the .zip folders for both the Word Count & Char Count and Notification plugin. After extraction, you should have a folder named wordcount and a folder named notification.
- Move the wordcount folder to /web/server/root/ckeditor/plugins/. Move the notification folder to /web/server/root/ckeditor/plugins/.
- Add the following line of text to the config.js file, which is located at /web/server/root/ckeditor/.
config.extraPlugins = 'wordcount';
Below is an example of what your config.js file might look like after adding config.extraPlugins = 'wordcount,notification';
CKEDITOR.editorConfig = function( config ) { config.extraPlugins = 'wordcount,notification'; config.toolbar [ et cetera . . . ]; };
There now should be text in the bottom right-hand corner of your CKEditor which counts the number of Paragraphs and number of Words in your CKEditor.
To modify the behavior of the Word Count & Char Count text at the bottom right-hand corner of your CKEditor, add the following text to your config.js file located at /web/server/root/ckeditor/config.js.
config.wordcount = { // Whether or not you Show Remaining Count (if Maximum Word/Char/Paragraphs Count is set) showRemaining: false, // Whether or not you want to show the Paragraphs Count showParagraphs: true, // Whether or not you want to show the Word Count showWordCount: true, // Whether or not you want to show the Char Count showCharCount: false, // Whether or not you want to Count Bytes as Characters (needed for Multibyte languages such as Korean and Chinese) countBytesAsChars: false, // Whether or not you want to count Spaces as Chars countSpacesAsChars: false, // Whether or not to include Html chars in the Char Count countHTML: false, // Whether or not to include Line Breaks in the Char Count countLineBreaks: false, // Whether or not to prevent entering new Content when limit is reached. hardLimit: true, // Whether or not to to Warn only When limit is reached. Otherwise content above the limit will be deleted on paste or entering warnOnLimitOnly: false, // Maximum allowed Word Count, -1 is default for unlimited maxWordCount: -1, // Maximum allowed Char Count, -1 is default for unlimited maxCharCount: -1, // Maximum allowed Paragraphs Count, -1 is default for unlimited maxParagraphs: -1, // How long to show the 'paste' warning, 0 is default for not auto-closing the notification pasteWarningDuration: 0, // Add filter to add or remove element before counting (see CKEDITOR.htmlParser.filter), Default value : null (no filter) filter: new CKEDITOR.htmlParser.filter({ elements: { div: function( element ) { if(element.attributes.class == 'mediaembed') { return false; } } } }) };
Note: If you plan to change some of the JavaScript, you probably will not want to use the CKBuilder, because this will place the JavaScript of the Word Count & Char Count plugin in the ckeditor.js file located at /web/server/root/ckeditor/ckeditor.js. The JavaScript for the Word Count & Char Count plugin in the ckeditor.js file is different than the JavaScript used when manually adding the Word Count & Char Count plugin. When manually adding the Word Count & Char Count plugin, the JavaScript will be in the plugin.js file located at
If you want to query the current wordcount you can do it via
// get the word count CKEDITOR.instances.editor1.wordCount.wordCount // get the char count CKEDITOR.instances.editor1.wordCount.charCount
w8tcha/ckeditor-wordcount-plugin 适用场景与选型建议
w8tcha/ckeditor-wordcount-plugin 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 479.83k 次下载、GitHub Stars 达 77, 最近一次更新时间为 2018 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「text」 「javascript」 「wysiwyg」 「editor」 「CKEditor」 「html」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 w8tcha/ckeditor-wordcount-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 w8tcha/ckeditor-wordcount-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 w8tcha/ckeditor-wordcount-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
Common libraries used by Zimbra Api
PHP client for the Google Closure Compiler API in one file.
统计信息
- 总下载量: 479.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 77
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-21