I am opening SharePoint dialog using following code:
var options = {
title: dialogTitle,
width: 800,
height: 600,
url: uri
}
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
However, the dimensions are in pixels. Is there any way to make the Pop-up responsive?
Related
I am making small code editor and i want user to be able to resize window if user wants. I have main window property non resizable.
mainWindow = new BrowserWindow({width: 800, height: 600 , resizable: false});
I have button
I have drop down menu :
label: 'Screen',
submenu:[
{
label:'Resizable Window',
click(){
mainWindow.resizable = false;
}
},
My code doesn't work. Please help me to fix it.
To change if a window is resizable you have to call mainWindow.setResizable(false) instead of .resizable = false.
And it seems that you're setting resizable to false when it's already false, I think you want to set it to true to enable resizing.
In summary you would end up with something like:
label: 'Screen',
submenu: [
{
label: 'Resizable Window',
click () {
mainWindow.setResizable(true);
}
},
],
.setResizable Docs.
could someone please point me in the direction for how to enable double click on fabric images? i came across this solution
FabricJS double click on objects
I am trying to not use FabicjsEx
but i am unable to get anything to work correctly. can someone please let me know the best way to accomplish this?
The best way to accomplish this, is to use fabric.util.addListener method.
Using that you could add a double click event for the canvas element and to restrict it to any particular object ( ie. image ), you would have to check whether you clicked on an image object or not before performing any action.
ᴅᴇᴍᴏ
var canvas = new fabric.Canvas('canvas');
// add image
fabric.Image.fromURL('https://i.imgur.com/Q6aZlme.jpg', function(img) {
img.set({
top: 50,
left: 50
})
img.scaleToWidth(100);
img.scaleToHeight(100);
canvas.add(img);
});
// add rect (for demo)
var rect = new fabric.Rect({
left: 170,
top: 50,
width: 100,
height: 100,
fill: '#07C'
});
canvas.add(rect);
// mouse event
fabric.util.addListener(canvas.upperCanvasEl, 'dblclick', function(e) {
if (canvas.findTarget(e)) {
const objType = canvas.findTarget(e).type;
if (objType === 'image') {
alert('double clicked on a image!');
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.7.9/fabric.js"></script>
<canvas id="canvas" width="320" height="200"></canvas>
I want to load different shapes in FabricJS based Canvas using loadSVGFromURL(), but can't. Documentation is also not complete on this. I just want a complete example. I can load it from string, but string creates spaces which creates problems when rendering. Here is my code:
var canvas = new fabric.Canvas('canvas');
fabric.loadSVGFromURL('BlueFlower.svg', function (objects) {
var SVG = fabric.util.groupSVGElements(objects, options);
canvas.add(SVG).centerObject(SVG).renderAll();
SVG.setCoords();
});
I have done an example on jsfiddle, that I create two objects and I load an svg image from url, you can take a look.
Here is an example
The snippet for load svg is this:
var site_url = 'http://fabricjs.com/assets/1.svg';
fabric.loadSVGFromURL(site_url, function(objects) {
var group = new fabric.PathGroup(objects, {
left: 165,
top: 100,
width: 295,
height: 211
});
canvas.add(group);
canvas.renderAll();
});
I need to add a popup modal to one of the webpart page in our sharepoint 2013 environment as an important notice, it works well when I sign in with the Admin account only, But not with other accounts, can anyone help me out?
Here is the javascript that I have:
_spBodyOnLoadFunctionNames.push('showPopup');
function showPopup() {
var options = {
url: myurl + '?IsDlg=1',
tite: ' Important Notice',
allowMaximize: false,
showClose: true,
width: 800,
height: 600
};
Modal Dialog Options
function Myfunction() {
var clientContext = new SP.ClientContext.get_current();
var options = {
url: clientContext.get_url() + "/_layouts/Page1.aspx",
showMaximized: true,
//width: 950,
//height: 1000,
dialogReturnValueCallback: myCallback
};
SP.UI.ModalDialog.showModalDialog(options);
return false;
}
function myCallback(dialogResult, returnValue) {
}
I am trying to hide the ribbon which is coming on the modal box .. I have the added the below css on Page1.aspx
<style type="text/css">
.s4-notdlg
{
display:none;
}
It hides only the Site Actions part and the logged in name of the user. I still have the black thick image of the ribbon on my page. I want the complete ribbon to be hidden. Also, the scroll bars appear on the page, but they do not scroll completely to the bottom of the page.
Some one please help me.
body{overflow:auto !important;}
#s4-leftpanel { display: none;}
.s4-ca {margin-left:0px !important;}
#s4-ribbonrow{height:auto !important;min-height:0px !important;}
#s4-ribboncont{display:none;}
#s4-titlerow{ display:none;}
.s4-ba {width:100%; min-height:0px !important;}
#s4-workspace{float:left;width:100%; overflow:auto !important;}
body #MSO_ContentTable{min-height:0px !important;position:inherit;}
Use above css in your page1.aspx
In sharepoint 2013 the following CSS worked for me:
.ms-dialog #s4-ribbonrow {
display: none;
}