{"id":5964,"date":"2019-02-27T13:54:47","date_gmt":"2019-02-27T10:54:47","guid":{"rendered":"https:\/\/dhtmlx.com\/blog\/?p=5964"},"modified":"2026-01-23T13:26:20","modified_gmt":"2026-01-23T10:26:20","slug":"dhtmlxrichtext-1-1","status":"publish","type":"post","link":"https:\/\/dhtmlx.com\/blog\/dhtmlxrichtext-1-1\/","title":{"rendered":"dhtmlxRichText 1.1: API to Work with Text, Block Quotes, and Advanced Statistics"},"content":{"rendered":"<p>A recently launched dhtmlxRichText, <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxRichText\/\" rel=\"noopener\" target=\"_blank\">JavaScript rich text editor<\/a>, receives its first minor update v1.1 with expanded functionality. We&#8217;ve provided developers with an easy and convenient way to work with content instantly via the editor&#8217;s API. The release also brings out a new toolbar block quote control for adding text quotes, an ability to serialize content into plain text, and advanced statistics for counting the number of characters, words and other text elements.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/rich-text-editor-1.1.png\" alt=\"Rich text editor with block quotes and statistics\" width=\"900\" height=\"207\" class=\"aligncenter size-full wp-image-5995\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/rich-text-editor-1.1.png 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/rich-text-editor-1.1-300x69.png 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/rich-text-editor-1.1-768x177.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/p>\n<p>Download <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxRichText\/download.shtml\" rel=\"noopener\" target=\"_blank\">JavaScript rich text trial<\/a> version 1.1 and let&#8217;s dive deeper into the release details!<\/p>\n<h5>Working With Rich Text Editor API<\/h5>\n<p>Starting with v1.1 developers gain access to the API of our JavaScript rich text editor that enables them to work with the text directly. Using the <strong>getEditorAPI()<\/strong> method you will get all the available methods for text processing such as adding a new text into the editor, styling it, adding a data model or returning it in the JSON format.<\/p>\n<p>For example, the <strong>update()<\/strong> method helps you to change the style of a text, e.g. apply a new style to it:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> api <span class=\"sy0\">=<\/span> rich.<span class=\"me1\">getEditorAPI<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n&nbsp;<br \/>\nrich.<span class=\"me1\">getEditorAPI<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span>.<span class=\"me1\">update<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; modifier<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;color&quot;<\/span><span class=\"sy0\">,<\/span><br \/>\n&nbsp; &nbsp; value<span class=\"sy0\">:<\/span> <span class=\"st0\">&quot;#BB2B1A&quot;<\/span><br \/>\n&nbsp; <span class=\"br0\">&#125;<\/span><span class=\"sy0\">,<\/span> api.<span class=\"me1\">getSelection<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>Learn more about all the available <a href=\"https:\/\/docs.dhtmlx.com\/richtext\/api\/config\/fullscreen-mode\/\" rel=\"noopener\" target=\"_blank\">API methods<\/a> in the documentation.<\/p>\n<h5>Editor with Quotation Marks<\/h5>\n<p>We&#8217;ve added a new <a href=\"https:\/\/docs.dhtmlx.com\/richtext\/guides\/configuration\/#toolbar\" rel=\"noopener\" target=\"_blank\">block quote control<\/a> to our set of default toolbar controls to easily turn ordinary text into quotations:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Text-quotes.png\" alt=\"Block quote control for text quotes\" width=\"900\" height=\"207\" class=\"aligncenter size-full wp-image-5976\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Text-quotes.png 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Text-quotes-300x69.png 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Text-quotes-768x177.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><a href=\"https:\/\/docs.dhtmlx.com\/richtext\/samples\/02_configuration\/03_full_toolbar.html\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>The block quote control is included in the toolbar by default. Additionally, you can include a new statistics control for displaying a number of characters or other elements:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> richtext <span class=\"sy0\">=<\/span> <span class=\"kw1\">new<\/span> dhx.<span class=\"me1\">Richtext<\/span><span class=\"br0\">&#40;<\/span>document.<span class=\"me1\">body<\/span><span class=\"sy0\">,<\/span> <span class=\"br0\">&#123;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"co1\">\/\/ full toolbar<\/span><br \/>\n&nbsp; &nbsp; toolbarBlocks<span class=\"sy0\">:<\/span> <span class=\"br0\">&#91;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"st0\">&quot;undo&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;style&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;decoration&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;colors&quot;<\/span><span class=\"sy0\">,<\/span> <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"st0\">&quot;align&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;link&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;clear&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;stats&quot;<\/span><span class=\"sy0\">,<\/span> <span class=\"st0\">&quot;fullscreen&quot;<\/span><span class=\"br0\">&#93;<\/span><br \/>\n&nbsp; &nbsp; <span class=\"br0\">&#93;<\/span><br \/>\n<span class=\"br0\">&#125;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<h5>Advanced and Custom Statistics<\/h5>\n<p>New API methods make RichText a more effective tool for text processing. From now on, our editor is able to <a href=\"https:\/\/docs.dhtmlx.com\/richtext\/api\/config\/fullscreen-mode\/\" rel=\"noopener\" target=\"_blank\">count<\/a> both characters with and without spaces as well as words using the <strong>getStats()<\/strong> method.<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> stats <span class=\"sy0\">=<\/span> richtext.<span class=\"me1\">getStats<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><br \/>\n<span class=\"br0\">&#123;<\/span>chars<span class=\"sy0\">:<\/span> <span class=\"nu0\">467<\/span><span class=\"sy0\">,<\/span> words<span class=\"sy0\">:<\/span> <span class=\"nu0\">80<\/span><span class=\"sy0\">,<\/span> charsExlSpace<span class=\"sy0\">:<\/span> <span class=\"nu0\">393<\/span><span class=\"br0\">&#125;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/statistics.png\" alt=\"Rich text editor statistics\" width=\"900\" height=\"191\" class=\"aligncenter size-full wp-image-5997\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/statistics.png 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/statistics-300x64.png 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/statistics-768x163.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><a href=\"https:\/\/docs.dhtmlx.com\/richtext\/samples\/02_configuration\/03_full_toolbar.html\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<p>The number of all counted elements can be displayed together or separately, depending on the needs of end-users.<\/p>\n<p>Showing the number of characters including spaces in a text:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> chars <span class=\"sy0\">=<\/span> richtext.<span class=\"me1\">getStats<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span>.<span class=\"me1\">chars<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>Showing the number of words in a text:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> chars <span class=\"sy0\">=<\/span> richtext.<span class=\"me1\">getStats<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span>.<span class=\"me1\">words<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>Showing the number of characters without spaces in a text:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"kw1\">var<\/span> chars <span class=\"sy0\">=<\/span> richtext.<span class=\"me1\">getStats<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span>.<span class=\"me1\">charsExlSpace<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p>You can also determine where and how to display the numbers counted by RichText. For instance, the editor may show these statistics in a separate container after an end user clicks on a button.<\/p>\n<p>However, the abilities of RichText are not limited to counting just words and characters. With the help of the <strong>customStats<\/strong> <a href=\"https:\/\/docs.dhtmlx.com\/richtext\/api\/config\/fullscreen-mode\/\" rel=\"noopener\" target=\"_blank\">configuration property<\/a> you can get any statistical characteristics you need (for example, a number of sentences):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/customstats.png\" alt=\"Text editor with custom statistics\" width=\"900\" height=\"166\" class=\"aligncenter size-full wp-image-5974\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/customstats.png 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/customstats-300x55.png 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/customstats-768x142.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><a href=\"https:\/\/docs.dhtmlx.com\/richtext\/samples\/02_configuration\/04_custom_stats.html\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<h5>Plain Text Format<\/h5>\n<p>Besides converting content into HTML and Markdown formats, RichText gets an ability to serialize it into <a href=\"https:\/\/docs.dhtmlx.com\/richtext\/api\/methods\/#getvalue\" rel=\"noopener\" target=\"_blank\">plain text<\/a> via the <strong>getValue()<\/strong> method:<\/p>\n<div class=\"codecolorer-container javascript default codecolorer-noborder\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"javascript codecolorer\"><span class=\"co1\">\/\/ getting content as a plain text<\/span><br \/>\n<span class=\"kw1\">var<\/span> content <span class=\"sy0\">=<\/span> richtext.<span class=\"me1\">getValue<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">&quot;text&quot;<\/span><span class=\"br0\">&#41;<\/span><span class=\"sy0\">;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Plain-text.png\" alt=\"Content serialization in plain text\" width=\"900\" height=\"218\" class=\"aligncenter size-full wp-image-5979\" srcset=\"https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Plain-text.png 900w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Plain-text-300x73.png 300w, https:\/\/dhtmlx.com\/blog\/wp-content\/uploads\/2019\/02\/Plain-text-768x186.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><a href=\"https:\/\/docs.dhtmlx.com\/richtext\/samples\/03_usage\/01_get_value.html\" rel=\"noopener\" target=\"_blank\">Check the sample ><\/a><\/p>\n<h5>Other Enhancements<\/h5>\n<p>Apart from new features, our dev team made a couple of improvements in the existing functionality. Among the most essential updates is support for the Asian languages. You can find the whole list <a href=\"https:\/\/docs.dhtmlx.com\/richtext\/news\/whats_new\/\" rel=\"noopener\" target=\"_blank\">in our docs<\/a>. <\/p>\n<p>Hope you&#8217;ll enjoy the update and find the newly added features useful for your applications! In any case, we invite you to share your ideas and feedback in our <a href=\"https:\/\/dhx-surveys.typeform.com\/to\/jrBOve\" rel=\"noopener\" target=\"_blank\">1-minute survey<\/a>. Also, feel free to leave your comments below!<\/p>\n<p>If you&#8217;re interested in our plans for future development of rich text editor, consult its <a href=\"https:\/\/trello.com\/b\/DgWqMcG6\/richtext-roadmap\" rel=\"noopener\" target=\"_blank\">public roadmap<\/a> and influence the development by voting for your preferred functionality.<\/p>\n<p>Current clients will find a download link for the updated version in their <a href=\"https:\/\/dhtmlx.com\/clients\/\" rel=\"noopener\" target=\"_blank\">Client&#8217;s Area<\/a>. <\/p>\n<h5>Related Material:<\/h5>\n<ul>\n<li>RichText <a href=\"https:\/\/docs.dhtmlx.com\/richtext\/\" rel=\"noopener\" target=\"_blank\">documentation<\/a><\/li>\n<li><a href=\"https:\/\/snippet.dhtmlx.com\/pdh5buvg?tag=richtext\" rel=\"noopener\" target=\"_blank\">Samples<\/a><\/li>\n<li><a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxRichText-for-Angular\/#how-it-works\" rel=\"noopener\" target=\"_blank\">Angular rich text editor<\/a>, <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxRichText-for-Vue\/#how-it-works\" rel=\"noopener\" target=\"_blank\">Vue.js rich text<\/a>, <a href=\"https:\/\/dhtmlx.com\/docs\/products\/dhtmlxRichText-for-React\/#how-it-works\" rel=\"noopener\" target=\"_blank\">React rich text editor<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>A recently launched dhtmlxRichText, JavaScript rich text editor, receives its first minor update v1.1 with expanded functionality. We&#8217;ve provided developers with an easy and convenient way to work with &#8230;<\/p>\n","protected":false},"author":101012,"featured_media":5994,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[70,1,38],"tags":[33,61,4],"class_list":["post-5964","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-releases","category-uncategorized","category-visible","tag-all-posts","tag-richtext","tag-dhtmlx-updates"],"_links":{"self":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/5964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/users\/101012"}],"replies":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/comments?post=5964"}],"version-history":[{"count":5,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/5964\/revisions"}],"predecessor-version":[{"id":14929,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/posts\/5964\/revisions\/14929"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media\/5994"}],"wp:attachment":[{"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/media?parent=5964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/categories?post=5964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dhtmlx.com\/blog\/wp-json\/wp\/v2\/tags?post=5964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}