JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://jp.igniteui.com/js/modernizr.min.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.core.js"></script>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/infragistics.lob.js"></script>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet"></link>
<link href="https://cdn-na.infragistics.com/igniteui/latest/css/structure/infragistics.css" rel="stylesheet"></link>
<script src="https://cdn-na.infragistics.com/igniteui/latest/js/i18n/infragistics-ja.js"></script>
<div id="htmlEditor"></div>
<br />
<div id="igUpload1"></div>
<div id="error-message" style="color: #FF0000; font-weight: bold;"></div>
CSS
span.ui-icon.ui-icon-contact {
background-image: url('https://jp.igniteui.com/igniteui/css/themes/infragistics/images/ui-icons_888888_256x240.png');
background-position: -177px -97px;
}
#dropZone {
position: absolute;
border: 3px dashed #bbb;
border-color: gray;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 1px;
text-align: center;
color: gray;
opacity: 0.3;
filter: alpha(opacity=30);
background-color: white;
vertical-align: middle;
font-size: 30px;
box-sizing: border-box;
}
/* Override sample's browser styles */
#htmlEditor h1, #htmlEditor h2, #htmlEditor h3, #htmlEditor h4, #htmlEditor h5, #htmlEditor h6 {
margin: 0px;
}
#htmlEditor h1 {
font-size: 1.9em;
}
#sampleContainer {
overflow: visible;
}
JavaScript
$(function () {
var height = $('html').hasClass('touch') ? 400 : 330;
$("#htmlEditor").igHtmlEditor({
height: height,
width: "100%"
});
// clear editor content
$("#htmlEditor").igHtmlEditor("setContent", "", "html");
$("#igUpload1").igUpload({
mode: "multiple",
autostartupload: true,
progressUrl: "https://jp.igniteui.com/IGUploadStatusHandler.ashx",
controlId: "serverID1",
multipleFiles: true,
maxUploadedFiles: 3,
allowedExtensions: ["gif", "jpg", "bmp", "png", "jpeg"],
errorMessageValidatingFileExtension: "ファイル拡張子はサポートされていません。画像ファイルをドラッグしてください。",
onError: function (e, args) {
showAlert(args);
},
fileUploaded: function (evt, ui) {
loadDataUriImages(ui.fileInfo.file);
// remove the drop zone element
$("#dropZone").remove();
// reset drop counter
dragging = 0;
}
});
});
function showAlert(args) {
$("#error-message").html(args.errorMessage).stop(true, true).fadeIn(600).delay(3000).fadeOut(700);
}
// counter for the solution 'dragleave' of parent element fires when dragging over children elements
var dragging = 0;
// Setup the enter listener
$("body").on({
"dragenter": handleDragEnter,
"dragleave": handleDragLeave
});
function handleDragEnter(evt) {
evt.stopPropagation();
evt.preventDefault();
dragging++;
if ($('#dropZone').length === 0) {
$("<div/>", {
id: "dropZone",
text: "画像をここまたは igUpload にドロップします。"
...