diff --git a/README.md b/README.md index 3d1b7ea6d..bb31ee66a 100644 --- a/README.md +++ b/README.md @@ -1023,6 +1023,9 @@ editor.getContext(); // Gets the contents of the suneditor // onlyContents {Boolean}: Return only the contents of the body without headers when the "fullPage" option is true editor.getContents(onlyContents: Boolean); +// Gets the current contents with containing parent div(div.sun-editor-editable). +//
{contents}
+editor.getFullContents(onlyContents: Boolean); // Gets only the text of the suneditor contents editor.getText(); diff --git a/sample/html/options.html b/sample/html/options.html index cde68adf6..c7ef06471 100644 --- a/sample/html/options.html +++ b/sample/html/options.html @@ -441,6 +441,8 @@

--Link

 check_new_window: 'noreferrer noopener',  check_bookmark: 'bookmark' } +

+

--HR

@@ -706,6 +708,7 @@

Applied options

linkProtocol: document.getElementById('linkProtocol').checked ? document.getElementById('linkProtocol_value').value : undefined, linkRel: document.getElementById('linkRel').checked ? ['author', 'external', 'help', 'license', 'next', 'follow', 'nofollow', 'noreferrer', 'noopener', 'prev', 'search', 'tag'] : undefined, linkRelDefault: document.getElementById('linkRelDefault').checked ? {default: 'nofollow', check_new_window: 'noreferrer noopener', check_bookmark: 'bookmark'} : undefined, + linkNoPrefix: document.getElementById('linkNoPrefix').checked ? true : undefined, shortcutsDisable: document.getElementById('shortcutsDisable').checked ? ['bold', 'strike', 'underline', 'italic', 'undo', 'indent'] : undefined, shortcutsHint: document.getElementById('shortcutsHint').checked ? undefined : false, callBackSave: document.getElementById('callBackSave').checked ? function (contents) { alert(contents) } : undefined, diff --git a/src/lib/core.js b/src/lib/core.js index 16a745c99..830d57f6f 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -4828,6 +4828,16 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re } }, + /** + * @description Gets the current contents with containing parent div(div.sun-editor-editable). + *
{contents}
+ * @param {Boolean} onlyContents Return only the contents of the body without headers when the "fullPage" option is true + * @returns {Object} + */ + getFullContents: function (onlyContents) { + return '
' + this.getContents(onlyContents) + '
'; + }, + /** * @description Returns HTML string according to tag type and configuration. * Use only "cleanHTML"