in Components/PCF/ImageAttachmentControl/ImageAttachmentControl/index.ts [51:96]
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container: HTMLDivElement) {
// Add control initialization code
this._context = context;
this._notifyOutputChanged = notifyOutputChanged;
this._container = document.createElement("div");
this._imgUploadBtn = document.createElement("a");
this._imgUploadBtn.setAttribute("class", "btn");
this._imgUploadBtn.innerHTML = "Upload";
this._imgUploadBtn.addEventListener("click", this.uploadImgonClick.bind(this));
var imgSizeLabel = document.createElement("p");
imgSizeLabel.innerHTML = "Image size must be less than 768KB";
this._divDropZone = document.createElement("div");
this._divDropZone.id = "dropzone";
this._formDropZone = document.createElement("form");
this._formDropZone.id = "upload_dropzone";
this._formDropZone.setAttribute("method", "post");
this._formDropZone.appendChild(this._imgUploadBtn);
this._formDropZone.appendChild(imgSizeLabel);
this._formDropZone.setAttribute("class", "dropzone needsclick");
this._divDropZone.appendChild(this._formDropZone);
this._divMain = document.createElement("div");
this._divImgContainer = document.createElement("div");
this._container.appendChild(this._divDropZone);
this._container.appendChild(this._divMain);
container.appendChild(this._container);
this._divMain.appendChild(this._divImgContainer);
if (this._context.parameters.Image && this._context.parameters.Image.raw) {
console.log(this._context.parameters.Image);
this.addImgControl(this._context.parameters.Image.raw);
}
this.onload();
toastr.options.closeButton = true;
toastr.options.progressBar = true;
toastr.options.positionClass = "toast-bottom-right";
}