diff --git a/www/common/metadata-manager.js b/www/common/metadata-manager.js index 71a5dcc74..928d7e0db 100644 --- a/www/common/metadata-manager.js +++ b/www/common/metadata-manager.js @@ -102,6 +102,10 @@ define([], function () { metadataLazyObj = JSON.parse(JSON.stringify(m)); change(false); }, + updateTitle: function (t) { + metadataObj.title = t; + change(true); + }, getMetadata: function () { checkUpdate(false); return Object.freeze(JSON.parse(JSON.stringify(metadataObj))); diff --git a/www/common/sframe-common-title.js b/www/common/sframe-common-title.js index d3c343210..9d611f9a2 100644 --- a/www/common/sframe-common-title.js +++ b/www/common/sframe-common-title.js @@ -12,8 +12,8 @@ define(['jquery'], function ($) { var getHeadingText = cfg.getHeadingText || function () { return; }; - var updateLocalTitle = function (newTitle) { - console.log(newTitle); +/* var updateLocalTitle = function (newTitle) { + console.error(newTitle); exp.title = newTitle; onLocal(); if (typeof cfg.updateLocalTitle === "function") { @@ -21,7 +21,7 @@ define(['jquery'], function ($) { } else { document.title = newTitle; } - }; + };*/ var $title; exp.setToolbar = function (toolbar) { @@ -39,11 +39,11 @@ define(['jquery'], function ($) { } }; - var renameCb = function (err, newTitle) { + /*var renameCb = function (err, newTitle) { if (err) { return; } - updateLocalTitle(newTitle); onLocal(); - }; + //updateLocalTitle(newTitle); + };*/ // update title: href is optional; if not specified, we use window.location.href exp.updateTitle = function (newTitle, cb) { @@ -58,11 +58,10 @@ define(['jquery'], function ($) { updateLocalTitle(oldTitle); return void cb(err); } - updateLocalTitle(data); + metadataMgr.updateTitle(newTitle); + //onLocal(); cb(null, data); if (!$title) { return; } - $title.find('span.title').text(data); - $title.find('input').val(data); }); }; @@ -75,12 +74,14 @@ define(['jquery'], function ($) { metadataMgr.onChange(function () { var md = metadataMgr.getMetadata(); - exp.updateTitle(md.title || md.defaultTitle); + $title.find('span.title').text(md.title || md.defaultTitle); + $title.find('input').val(md.title || md.defaultTitle); + //exp.updateTitle(md.title || md.defaultTitle); }); exp.getTitleConfig = function () { return { - onRename: renameCb, + updateTitle: exp.updateTitle, suggestName: suggestTitle, defaultName: exp.defaultTitle }; diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 97720dc67..b6093e1f2 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -515,7 +515,7 @@ define([ console.error("config.title", config); throw new Error("config.title is not an object"); } - var callback = config.title.onRename; + var updateTitle = config.title.updateTitle; var placeholder = config.title.defaultName; var suggestName = config.title.suggestName; @@ -568,12 +568,9 @@ define([ if (name === "") { name = $input.attr('placeholder'); } - console.log('here'); - Common.setPadTitleInDrive(name, function (err, newtitle) { - console.log('here'); + updateTitle(name, function (err, newtitle) { if (err) { return console.error(err); } - $text.text(newtitle); - callback(null, newtitle); + //$text.text(newtitle); $input.hide(); $text.show(); $pencilIcon.show(); diff --git a/www/pad2/main.js b/www/pad2/main.js index 761a24138..2f172261f 100644 --- a/www/pad2/main.js +++ b/www/pad2/main.js @@ -485,6 +485,8 @@ define([ toolbar = info.realtime.toolbar = Toolbar.create(configTb); Title.setToolbar(toolbar); + var $rightside = toolbar.$rightside; + $bar.find('#cke_1_toolbar_collapser').hide(); if (!readOnly) { // Expand / collapse the toolbar @@ -559,7 +561,7 @@ define([ //Title.setToolbar(toolbar); - var $rightside = toolbar.$rightside; + //var $rightside = toolbar.$rightside; var $drawer = toolbar.$drawer; var editHash;