php 在jquery弹出窗口中装入ckeditor

shyt4zoc  于 2023-01-29  发布在  PHP
关注(0)|答案(2)|浏览(139)

我正在尝试加载一个ckeditor到jquery弹出窗口。我正在使用simplemodal。当用户点击博客上的编辑按钮时,窗口就会加载。它会加载,但编辑器是不活动的,我不能从mysql数据库加载内容。任何帮助都是很好的。
电码
启用模态

<script type='text/javascript' src='../_Js/jquery.simplemodal.js'></script>
<script>
jQuery(function ($) {
    $('.edit').click(function (e) {
        $('#blog-edit-content').modal();
        return false;
    });
});
</script>

要加载以下内容的链接

<a class="edit" style="font-size:16px;color:#CCC;" href="">Edit</a>

要加载的内容

<div id="blog-edit-content" style="display:none;">
    <form name="newblog" id="newblog" action="#" method="post">
         <font color="#000000"><strong>Title: </strong></font>
         <input name="blogtitle" id="blogtitle" type="text" id="title"  size="80" maxlength="255" value="'.$blogtitle.'" /><br /><br />
         <textarea class="ckeditor" cols="80" id="blog-edit-body" name="blog-edit-body" rows="10"></textarea><br /> 
         Please separate tages with a <strong>comma</strong>.<br />
         <font color="#000000"><strong>Tags: </strong></font>
         <input name="tags" id="tags" type="text" size="80" maxlength="255" alue="tags" /><br /><br />
         <input type="submit" value="Post Blog" />
         <span id="blogFormProcessGif" style="display:none;">
             <img src="../_Images/loading.gif" width="28px" height="28px" alt="Loading" />
         </span>
    </form>
</div>

当弹出窗口加载检查器,但它是不活动的,我不知道如何加载内容到它。
谢谢

icnyk63a

icnyk63a1#

试试这个代码,它是从文档和工程完美在我结束

<!DOCTYPE html>
<!--
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>API Usage &mdash; CKEditor Sample</title>
<script src="ckeditor/ckeditor.js"></script>
<link href="sample.css" rel="stylesheet">
<script>

// The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function( ev ) {

// Show this sample buttons.
document.getElementById( 'eButtons' ).style.display = 'block';
});

function GetContents() {
// Get the editor instance that you want to interact with.
var editor = CKEDITOR.instances.editor1;

// Get editor contents
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getData
alert( editor.getData());
}
function Focus() {
CKEDITOR.instances.editor1.focus();
}

function onFocus() {
document.getElementById( 'eMessage' ).innerHTML = '<b>' + this.name + ' is focused </b>';
}

function onBlur() {
document.getElementById( 'eMessage' ).innerHTML = this.name + ' lost focus';
}

</script>

</head>
<body>
<h1 class="samples">
  <noscript>
  </noscript>
</h1>
<form action="../../../samples/sample_posteddata.php" method="post">
  <textarea cols="100" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>

    <script>
        // Replace the <textarea id="editor1"> with an CKEditor instance.
        CKEDITOR.replace( 'editor1', {
            on: {
                focus: onFocus,
                blur: onBlur,

                // Check for availability of corresponding plugins.
                pluginsLoaded: function( evt ) {
                    var doc = CKEDITOR.document, ed = evt.editor;
                    if ( !ed.getCommand( 'bold' ) )
                        doc.getById( 'exec-bold' ).hide();
                    if ( !ed.getCommand( 'link' ) )
                        doc.getById( 'exec-link' ).hide();
                }
            }
        });
    </script>

</form><br>

<input type="button" onClick="javascript:GetContents()" value="Save"/>
</body>
</html>
3z6pesqy

3z6pesqy2#

Modelbox中Web编辑器解决方案:添加数据-bs-focus=“假”
示例:class=“模态自定义模态淡入淡出”role=“对话框”data-bs-focus=“false”

相关问题