我正在使用CKEditor 4.4.5及其插件樣式表解析器4.4,但我從樣式下拉列表中獲得空列表。CKEditor樣式表解析器
爲了使我的問題更容易理解,請試試這個代碼(下載從示例站點:http://sdk.ckeditor.com/samples/styles.html):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title>Stylesheet Parser plugin</title>
<script src="http://cdn.ckeditor.com/4.5.2/standard-all/ckeditor.js"></script>
</head>
<body>
<textarea cols="80" id="editor2" name="editor2" rows="10" ><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>
</textarea>
<script>
CKEDITOR.replace('editor2', {
extraPlugins: 'stylesheetparser',
height: 300,
// Custom stylesheet for editor content.
contentsCss: [ 'http://sdk.ckeditor.com/samples/assets/stylesheetparser/stylesheetparser.css' ],
// Do not load the default Styles configuration.
stylesSet: []
});
</script>
</body>
</html>
它並沒有真正的工作。但該網站上的示例運行良好。 我還發現另一個示例網站: http://ckeditor.com/ckeditor_4.3_beta/samples/plugins/stylesheetparser/stylesheetparser.html
我試圖複製此演示網站的所有源代碼,但沒有運氣。
其他人是否也有同樣的問題? 如何使上述代碼正常工作?它基本上使用CDN網站的源代碼,所以我不認爲源代碼的版本很重要。
跨域請求?您從cdn.ckeditor.com拉取.js代碼,但嘗試從sdk.ckeditor.com加載css。無論如何,請檢查您的JS請求是否有錯誤/警告。 –
控制檯中沒有錯誤。從sdk.ckeditor.com加載CSS是好的,因爲我認爲網站所有者將它設置爲允許跨域請求。另外,我已經嘗試使用我的本地CSS文件。相同的結果:空列表。 – Joey