I'm just finished creating a WYSIWYG, but I have a problem with the text box.
Clicking on the icon for the text box triggers a onClick
that creates the text box, which is created with an% ed_config - div
(I had problems with contenteditable="true"
).
My problem is: When I click the new icon, I need it to create another text box instead of simply deleting the current one.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><!DOCTYPEhtml><html><head><metacharset="utf-8">
</head>
<body>
<script>
function ctexto() {
document.getElementById("editavel").innerHTML =
'<div class="ui-widget-content, draggable">Arrastar<div id="divv" class="" contenteditable="true" >Este é um texto de teste</div></div>';
$(".draggable")
.draggable()
.click(function(){
if ( $(this).is('.ui-draggable-dragging') ) {
return;
}
$(this).draggable( "option", "disabled", true );
$(this).attr('contenteditable','true');
$(this).attr('resizable','false');
})
.blur(function(){
$(this).draggable( 'option', 'disabled', false);
$(this).attr('contenteditable','false');
});
}
</script>
<input type="button" onClick="ctexto()" value="Texto">
<div name="editavel" id="editavel"></div>
</body>
</html>
This code here is a bit misfit, but you should understand the script.