قمت بتنصيب محرر ckeditor5 في المنتدى
لكن المشكل الذي واجهني هو كود إدراج أكواد bbcode في المحرر
هذا كود تمبلت editor_js
ماهي التعديلات التي يمكن عملها لكي أتمكن من إدراج أكواد bbcode في المحرر
مع الشكر للمساعدة
PHP
<html lang="en">
<head>
<meta charset="utf-8">
<title>CKEditor 5 – Classic editor</title>
<link rel="stylesheet" href="{$ForumAdress}look/ckeditor5/transfonter/stylesheet.css" />
<script type="text/javascript" src="{$ForumAdress}look/ckeditor5/build/ckeditor.js"></script>
</head>
<body>
<h1>Classic editor</h1>
<textarea cols="50" id="text" name="text" rows="5">
{$text}
{$send_text}
{$GetReplyInfo}
{$GetSubjectInfo}
{$prev}
{$quote}
{$Sign}
{template}multi_quote{/template}
</textarea>
<script>
ClassicEditor
.create( document.querySelector( '#text' ), {
codeBlock: {
languages: [
{ language: 'css', label: 'CSS' },
{ language: 'html', label: 'HTML' },
{ language: 'js', label: 'JavaScript',},
{ language: 'plaintext', label: 'Plain Text' }
]
},
fontFamily: {
options: [
'Droid Arabic Kufi',
'Mikhak'
]
},
fontSize: {
options: [
9,
11,
13,
'default',
17,
19,
21
]
}
} )
.catch( error => {
console.log( error );
} );
</script>
<dd class="smiles-bbcode">
<?php if($PowerBB->_CONF['template']['while']['Custom_bbcodesList']){?>
<fieldset class="pkr-b">
<legend class="pkr-b"><span class="smallfont" dir="rtl">{$lang['custom_bbcodes_mor']} BBcode</span></legend>
{Des::while}{Custom_bbcodesList}
{if {$Custom_bbcodesList['bbcode_useoption']} == '1'}
<span class="['bbcode_switch']" onclick="Custom_bbcodes_option('{$Custom_bbcodesList['bbcode_tag']}');" onmouseover="overIcon(this)" onmouseout="outIcon(this)" title="{$Custom_bbcodesList['bbcode_desc']}" class="editorbutton brd0" />{$Custom_bbcodesList['bbcode_switch']}</span>
{else}
<span class="['bbcode_switch']" onclick="Custom_bbcodes('{$Custom_bbcodesList['bbcode_tag']}');" title="{$Custom_bbcodesList['bbcode_desc']}" class="editorbutton brd0" />{$Custom_bbcodesList['bbcode_switch']}</span>
{/if}
<script type='text/javascript'>
function getSelectedHtml(editor)
{
var selection = editor.getSelection();
if( selection )
{
var bookmarks = selection.createBookmarks(),
range = selection.getRanges()[ 0 ],
fragment = range.clone().cloneContents();
selection.selectBookmarks( bookmarks );
var retval = "",
childList = fragment.getChildren(),
childCount = childList.count();
for ( var i = 0; i < childCount; i++ )
{
var child = childList.getItem( i );
retval += ( child.getOuterHtml?
child.getOuterHtml() : child.getText() );
}
return retval;
}
};
function Custom_bbcodes(bbcode_tag){
var editor = ClassicEditor.instances.text;
editor.insertHtml('['+bbcode_tag+']' + getSelectedHtml(editor) + '[/'+bbcode_tag+']');
}
function Custom_bbcodes_option(bbcode_tag,option){
var option = cbPrompt(bbcode_tag, '');
if(option){
var editor = ClassicEditor.instances.text;
editor.insertHtml('['+bbcode_tag+'='+option+']' + getSelectedHtml(editor) + '[/'+bbcode_tag+']');
}
}
</script>
{/Des::while}
</fieldset>
{/if}