загрузка ckeditor во всплывающем окне jquery

0

Я пытаюсь загрузить ckeditor в всплывающее окно jquery. Я использую simplemodal. Окно загружается, когда пользователь нажимает кнопку EDIT в блоге. Он загружается, но редактор неактивен, и я не могу загрузить содержимое из базы данных 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>

Когда всплывающее окно загружает ckeditor, но оно неактивно, и я не уверен, как загрузить содержимое в него.

благодаря

  • 0
    сначала пройдите документацию !!
  • 0
    Добавленный код выше
Показать ещё 1 комментарий
Теги:
ckeditor

1 ответ

0

Попробуйте этот код, это из документации и отлично работает на моем конце

<!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>
  • 0
    Спасибо, у меня нет проблем с загрузкой редактора на странице амина, это когда я загружаю его во всплывающее окно jquery.
  • 0
    возможно, потому что вы спрятали # blog-edit-content во время загрузки, попробуйте display:'anything but none'; на display:'anything but none'; и скрыть его от JavaScript после того, как документ будет готов

Ещё вопросы

Сообщество Overcoder
Наверх
Меню