document title improvements

master
Mark MacKay 2021-06-24 11:14:25 -05:00
parent 152de8d9a6
commit c4838b129f
5 changed files with 10 additions and 6 deletions

View File

@ -146,6 +146,7 @@ MD.Canvas = function(){
function rename(str) {
if (str.length) {
$('#canvas_title').val(str);
svgCanvas.setDocumentTitle(str);
}
}

View File

@ -82,6 +82,7 @@ MD.Import = function(){
if(success) {
callback(true);
editor.saveCanvas();
state.set("canvasTitle", svgCanvas.getDocumentTitle());
} else {
$.alert("Error: Unable to load SVG data", function() {
callback(false);

View File

@ -1,7 +1,6 @@
MD.Title = function(){
$('#canvas_title')
.val(state.get("canvasTitle"))
.keydown(function(e){
e.stopPropagation();
if (e.key === "Escape") {
@ -14,13 +13,11 @@ MD.Title = function(){
.keyup(function(e){
e.stopPropagation();
svgCanvas.setDocumentTitle(this.value);
state.set("canvasTitle", this.value);
})
.click(function(e) {
this.focus();
this.select();
})
.blur(function(e){
state.set("canvasTitle", this.value);
});
}

View File

@ -119,8 +119,11 @@ const eyedropper = svgCanvas.addExtension.apply(this, ["eyedropper", MD.Eyedropp
state.set("canvasId", t("Untitled"));
state.set("canvasMode", state.get("canvasMode"));
svgCanvas.setSvgString(state.get("canvasContent"));
state.set("canvasTitle", svgCanvas.getDocumentTitle());
//editor.paintBox.fill.setPaint(state.get("canvasFill"));
//editor.paintBox.stroke.setPaint(state.get("canvasStroke"));
//editor.paintBox.canvas.setPaint(state.get("canvasBackground"));
document.body.classList.remove("loading");
document.getElementById("workarea").removeAttribute("title");
document.getElementById("svgcanvas").removeAttribute("title");

View File

@ -6061,7 +6061,8 @@ this.importSvgString = function(xmlString) {
setUseData(svg);
convertGradients(svg);
// recalculate dimensions on the top-level children so that unnecessary transforms
// are removed
svgedit.utilities.walkTreePost(svgcontent, function(n){try{recalculateDimensions(n)}catch(e){console.log(e)}});
@ -6088,6 +6089,7 @@ this.importSvgString = function(xmlString) {
}
layer.appendChild(g);
batchCmd.addSubCommand(new InsertElementCommand(g));
clearSelection();
addToSelection([g]);