mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 1377851 - Load code mirror frame from external file within devtools. r=pbrosset
This commit is contained in:
parent
00fb80dbbc
commit
766b8a4ab0
@ -29,6 +29,7 @@ devtools.jar:
|
||||
content/sourceeditor/codemirror/codemirror.bundle.js (sourceeditor/codemirror/codemirror.bundle.js)
|
||||
content/sourceeditor/codemirror/lib/codemirror.css (sourceeditor/codemirror/lib/codemirror.css)
|
||||
content/sourceeditor/codemirror/mozilla.css (sourceeditor/codemirror/mozilla.css)
|
||||
content/sourceeditor/codemirror/cmiframe.html (sourceeditor/codemirror/cmiframe.html)
|
||||
content/sourceeditor/codemirror/old-debugger.css (sourceeditor/codemirror/old-debugger.css)
|
||||
content/debugger/new/index.html (debugger/new/index.html)
|
||||
content/debugger/debugger.xul (debugger/debugger.xul)
|
||||
|
15
devtools/client/sourceeditor/codemirror/cmiframe.html
Normal file
15
devtools/client/sourceeditor/codemirror/cmiframe.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html dir='ltr'>
|
||||
<head>
|
||||
<style id="cmBaseStyle">
|
||||
html, body { height: 100%; }
|
||||
body { margin: 0; overflow: hidden; }
|
||||
.CodeMirror { width: 100% !important; line-height: 1.25 !important; }
|
||||
</style>
|
||||
<link rel='stylesheet' href="chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css">
|
||||
<link rel='stylesheet' href="chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.css">
|
||||
<link rel='stylesheet' href="chrome://devtools/content/sourceeditor/codemirror/mozilla.css">
|
||||
<link rel='stylesheet' href="chrome://devtools/content/sourceeditor/codemirror/old-debugger.css">
|
||||
</head>
|
||||
<body class='theme-body devtools-monospace'></body>
|
||||
</html>
|
@ -48,37 +48,14 @@ const {
|
||||
|
||||
const { OS } = Services.appinfo;
|
||||
|
||||
// CM_STYLES, CM_SCRIPTS and CM_IFRAME represent the HTML,
|
||||
// JavaScript and CSS that is injected into an iframe in
|
||||
// order to initialize a CodeMirror instance.
|
||||
|
||||
const CM_STYLES = [
|
||||
"chrome://devtools/content/sourceeditor/codemirror/lib/codemirror.css",
|
||||
"chrome://devtools/content/sourceeditor/codemirror/addon/dialog/dialog.css",
|
||||
"chrome://devtools/content/sourceeditor/codemirror/mozilla.css"
|
||||
];
|
||||
|
||||
CM_STYLES.push(
|
||||
"chrome://devtools/content/sourceeditor/codemirror/old-debugger.css"
|
||||
);
|
||||
// CM_SCRIPTS and CM_IFRAME represent the HTML and JavaScript that is
|
||||
// injected into an iframe in order to initialize a CodeMirror instance.
|
||||
|
||||
const CM_SCRIPTS = [
|
||||
"chrome://devtools/content/sourceeditor/codemirror/codemirror.bundle.js",
|
||||
];
|
||||
|
||||
const CM_IFRAME =
|
||||
"data:text/html;charset=utf8,<!DOCTYPE html>" +
|
||||
"<html dir='ltr'>" +
|
||||
" <head>" +
|
||||
" <style>" +
|
||||
" html, body { height: 100%; }" +
|
||||
" body { margin: 0; overflow: hidden; }" +
|
||||
" .CodeMirror { width: 100% !important; line-height: 1.25 !important; }" +
|
||||
" </style>" +
|
||||
CM_STYLES.map(style => "<link rel='stylesheet' href='" + style + "'>").join("\n") +
|
||||
" </head>" +
|
||||
" <body class='theme-body devtools-monospace'></body>" +
|
||||
"</html>";
|
||||
const CM_IFRAME = "chrome://devtools/content/sourceeditor/codemirror/cmiframe.html";
|
||||
|
||||
const CM_MAPPING = [
|
||||
"focus",
|
||||
|
@ -8,8 +8,9 @@ function test() {
|
||||
waitForExplicitFinish();
|
||||
setup((ed, win) => {
|
||||
// appendTo
|
||||
let src = win.document.querySelector("iframe").getAttribute("src");
|
||||
ok(~src.indexOf(".CodeMirror"), "correct iframe is there");
|
||||
let cmFrame = win.document.querySelector("iframe");
|
||||
let cmStyle = cmFrame.contentDocument.getElementById("cmBaseStyle");
|
||||
ok(~cmStyle.innerHTML.indexOf(".CodeMirror"), "correct iframe is there");
|
||||
|
||||
// getOption/setOption
|
||||
ok(ed.getOption("styleActiveLine"), "getOption works");
|
||||
|
Loading…
Reference in New Issue
Block a user