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

Problem restoring to editor after pasting any text and saving it to database #121

Open
Ademgenc53 opened this issue Feb 14, 2021 · 0 comments

Comments

@Ademgenc53
Copy link

Ademgenc53 commented Feb 14, 2021

Hello,
I'm using PHP and PDO, I am very happy with this editor, except one problem, no other problems
OR
I'm doing wrong somewhere

When I write and save text in the editor, there is no problem loading text back into the editor.
However, when I copy text from anywhere and paste it into the text editor and save it, the text is not restored inside the editor
OR
Text is not restored inside the editor even when there is only text in the database(without any html tags)
aaaaaaa

I'm trying both options

echo addslashes($read['content_text']);
echo $read['content_text'];
<textarea id="txtEditor3"></textarea>
<textarea id="content_text" name="content_text" style="display:none;"></textarea>

<script language="javascript" type="text/javascript">
  $(document).ready( function() {
    $("#txtEditor3").Editor();
      $("#txtEditor3").Editor("setText", "<?php echo addslashes($read['content_text']); ?>");  // From the database into the editor
        $("input:submit").click(function(){
          $('#content_text').text($('#txtEditor3').Editor("getText"));
        });
   });
</script>

Column in PDO database
'content_text' longtext COLLATE utf8_general_ci DEFAULT NULL

I am writing to the database in this way

        $sql = $PDOdatabase->prepare(" UPDATE table SET content_text=? WHERE id=? ");
        $sql->execute([$_POST['content_text'], '1']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant