Anonymous
Вставка SuneditorHTML
Сообщение
Anonymous » 15 июл 2024, 15:33
Я пытаюсь использовать функцию: InsertHTML
Согласно руководству: editor.insertHTML('TEXTO DE TESTE', true, true);
Я создал кнопку и вставил jquery
suneditor.insertHTML('Text 1', true, true);
Но когда нажатие кнопки не добавляет текст. Но если я нажму на редактор, а затем на кнопку, текст будет добавлен.
Что я делаю не так?
Код: Выделить всё
Text 1
Text 2
Text 3
Teste de Editor
$(document).ready(function(){
$("#text1").click( function(){
suneditor.insertHTML('Text 1', true, true);
});
$("#text2").click( function(){
suneditor.insertHTML('Text 3', true, true);
});
$("#text3").click( function(){
suneditor.insertHTML('Text 2', true, true);
});
suneditor = SUNEDITOR.create('exampleOptions',{
font : [
'Arial',
'tahoma',
'Courier New,Courier'
],
fontSize : [
8, 10, 14, 18, 24, 36
],
colorList: [
['#ccc', '#dedede', 'OrangeRed', 'Orange', 'RoyalBlue', 'SaddleBrown'],
['SlateGray', 'BurlyWood', 'DeepPink', 'FireBrick', 'Gold', 'SeaGreen']
],
paragraphStyles: [
'spaced',
'neon',
{
name: 'Custom',
class: '__se__customClass'
}
],
textStyles: [
'translucent',
{
name: 'Emphasis',
style: '-webkit-text-emphasis: filled;',
tag: 'span'
}
],
width: '100%',
maxWidth: '600px',
minWidth: 400,
height : 'auto',
videoWidth : '80%',
youtubeQuery : 'autoplay=1&mute=1&enablejsapi=1',
imageWidth : 150,
popupDisplay: 'local',
resizingBar: false,
buttonList : [
[
Подробнее здесь:
https://stackoverflow.com/questions/716 ... inserthtml
1721046811
Anonymous
Я пытаюсь использовать функцию: InsertHTML Согласно руководству: editor.insertHTML('TEXTO DE TESTE', true, true); Я создал кнопку и вставил jquery suneditor.insertHTML('Text 1', true, true); Но когда нажатие кнопки не добавляет текст. Но если я нажму на редактор, а затем на кнопку, текст будет добавлен. Что я делаю не так? [code] Text 1 Text 2 Text 3 Teste de Editor $(document).ready(function(){ $("#text1").click( function(){ suneditor.insertHTML('Text 1', true, true); }); $("#text2").click( function(){ suneditor.insertHTML('Text 3', true, true); }); $("#text3").click( function(){ suneditor.insertHTML('Text 2', true, true); }); suneditor = SUNEDITOR.create('exampleOptions',{ font : [ 'Arial', 'tahoma', 'Courier New,Courier' ], fontSize : [ 8, 10, 14, 18, 24, 36 ], colorList: [ ['#ccc', '#dedede', 'OrangeRed', 'Orange', 'RoyalBlue', 'SaddleBrown'], ['SlateGray', 'BurlyWood', 'DeepPink', 'FireBrick', 'Gold', 'SeaGreen'] ], paragraphStyles: [ 'spaced', 'neon', { name: 'Custom', class: '__se__customClass' } ], textStyles: [ 'translucent', { name: 'Emphasis', style: '-webkit-text-emphasis: filled;', tag: 'span' } ], width: '100%', maxWidth: '600px', minWidth: 400, height : 'auto', videoWidth : '80%', youtubeQuery : 'autoplay=1&mute=1&enablejsapi=1', imageWidth : 150, popupDisplay: 'local', resizingBar: false, buttonList : [ [[/code] Подробнее здесь: [url]https://stackoverflow.com/questions/71683827/suneditor-inserthtml[/url]