Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser #275

Closed
pazicb opened this issue Mar 20, 2020 · 18 comments
Closed

Browser #275

pazicb opened this issue Mar 20, 2020 · 18 comments
Labels

Comments

@pazicb
Copy link

pazicb commented Mar 20, 2020

Hello,
How do i have to proceed? I need to view only SunEditor content, including "katex".
I need the user to see the content, not edit it and not see the editor control.

Thank you.

@MRB60
Copy link

MRB60 commented Mar 20, 2020

Place the html output from editor within a div and add class:

<div class="sun-editor-editable"><p>my suneditor contents</p></div>

@pazicb
Copy link
Author

pazicb commented Mar 20, 2020

Thank you, but unfortunately I do not see mathematical formulas.

@JiHong88
Copy link
Owner

Hi
Do you means to use only the "math" plugin without editing the editor directly?

@pazicb
Copy link
Author

pazicb commented Mar 20, 2020

Yes, in SunEditor I want to prepare texts including math formulas and then display it without an editor.

@JiHong88
Copy link
Owner

Yup,
Just remove the "contenteditable" attribute.

import katex from 'katex'

const editor = suneditor.create('id', {
  buttonList: [['math']],
  katex: katex
})

editor.core.context.element.wysiwyg.removeAttribute('contenteditable')

@pazicb
Copy link
Author

pazicb commented Mar 20, 2020

Thank you, but I need to hide everything from the editor. Buttons, header and footer.

@JiHong88
Copy link
Owner

Ok, Use it like this.

const editor = suneditor.create("id", {
  resizingBar: false,
  katex: katex
})
editor.toolbar.hide();

@pazicb
Copy link
Author

pazicb commented Mar 21, 2020

Thank you for your quick help. I have one more problem, when I start the editor I see "undefined" and I don't see "placeholder"

@JiHong88
Copy link
Owner

Can I see your code?
How did you defined the editor?

@pazicb
Copy link
Author

pazicb commented Mar 22, 2020

When the editor is started, the text "undefined" is displayed in the editor.

<link href="suneditor.min.css" rel="stylesheet" />
<script src="suneditor.min.js"></script>
chatContent = SUNEDITOR.create('tbChatContent', {
      "mode": "classic",
               "katex": "window.katex",
               "buttonList": [
                   [
                       "undo",
                       "redo",
                       "font",
                       "fontSize",
                       "formatBlock",
                       "paragraphStyle",
                       "blockquote",
                       "bold",
                       "underline",
                       "italic",
                       "strike",
                       "subscript",
                       "superscript",
                       "fontColor",
                       "hiliteColor",
                       "textStyle",
                       "removeFormat",
                       "outdent",
                       "indent",
                       "align",
                       "horizontalRule",
                       "list",
                       "lineHeight",
                       "table",
                       "link",
                       "image",
                       "video",
                       "math",
                       "fullScreen",
                       "showBlocks",
                       "codeView",
                       "preview",
                       "print",
                       "save",
                       "template"
                   ]
               ],
               "lang": SUNEDITOR_LANG.en,
               "lang(In nodejs)": "en"
   });

@JiHong88
Copy link
Owner

JiHong88 commented Mar 22, 2020

Remove this code "lang(In nodejs)": "en"
This is shows additionally how to define language files in nodejs environment.
And Modify code "katex": "window.katex", -> "katex": window.katex,
This is shown to text as a limitation of expression in the sample code.
Then include the "katex" library.

<!-- KaTeX -->
<script src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css">

@pazicb
Copy link
Author

pazicb commented Mar 22, 2020

It is still the same. The editor starts correctly, works correctly, but it contains the word "undefined", which I can delete.

@JiHong88
Copy link
Owner

Where is the "undefined" character included?
Can you show me a screenshot?

@pazicb
Copy link
Author

pazicb commented Mar 22, 2020

img

@JiHong88
Copy link
Owner

Are you using "placeholder" option?
Can I see the HTML code and script code?

@pazicb
Copy link
Author

pazicb commented Mar 22, 2020

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <link href="css/suneditor.min.css" rel="stylesheet" />
    <script src="suneditor.min.js"></script>   
    <script src="en.js"></script>
    <script  src = "https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js"> </script>
    <link  rel = "stylesheet" href ="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" />
</head>
<body>  
   <div id="editor">
   </div>
    <script>
        var editor = SUNEDITOR.create('editor', {
                "mode": "classic",
            "katex": window.katex,
                "buttonList": [
                    [
                        "undo",
                        "redo",
                        "font",
                        "fontSize",
                        "formatBlock",
                        "paragraphStyle",
                        "blockquote",
                        "bold",
                        "underline",
                        "italic",
                        "strike",
                        "subscript",
                        "superscript",
                        "fontColor",
                        "hiliteColor",
                        "textStyle",
                        "removeFormat",
                        "outdent",
                        "indent",
                        "align",
                        "horizontalRule",
                        "list",
                        "lineHeight",
                        "table",
                        "link",
                        "image",
                        "video",
                        "math",
                        "fullScreen",
                        "showBlocks",
                        "codeView",
                        "preview",
                        "print",
                        "save",
                        "template"
                    ]
                ],
                "lang": SUNEDITOR_LANG.en
        });       
    </script>
</body>
</html>`

@JiHong88
Copy link
Owner

The constructor element of suneditor is "textarea".

<textarea id="editor"></textarea>

Please see here: getting-started

@pazicb
Copy link
Author

pazicb commented Mar 22, 2020

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants