forked from swmitra/html-designer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DesignAreaSandboxingHandler.js
34 lines (25 loc) · 1.05 KB
/
DesignAreaSandboxingHandler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* @author Swagatam Mitra
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, document, console, brackets, $, Mustache */
define(function (require, exports, module) {
"use strict";
var AppInit = brackets.getModule("utils/AppInit"),
CommandManager = brackets.getModule("command/CommandManager");
var sandbox="allow-same-origin";
function _toggleSanboxing(){
var existing = $('#htmldesignerIframe').attr('sandbox');
if(existing){
$('#htmldesignerIframe').attr('sandbox',null);
$('#sandbox-frame').attr('title','Enable Sandboxing');
} else {
$('#htmldesignerIframe').attr('sandbox',sandbox);
$('#sandbox-frame').attr('title','Disable Sandboxing');
}
}
$(document).on("click", "#sandbox-frame", _toggleSanboxing);
AppInit.appReady(function () {
CommandManager.register("Toggle Sandboxing", "toggle.design.sandboxing", _toggleSanboxing);
});
});