remove apf.xPath

pull/125/merge
nightwing 2017-03-24 22:43:27 +04:00
rodzic e4613b0f2c
commit 86913a1857
5 zmienionych plików z 54 dodań i 1007 usunięć

Wyświetl plik

@ -15,7 +15,6 @@ define(function(require, exports, module) {
var settings = imports.settings; var settings = imports.settings;
var ui = imports.ui; var ui = imports.ui;
var anims = imports.anims; var anims = imports.anims;
var util = imports.util;
var menus = imports.menus; var menus = imports.menus;
var commands = imports.commands; var commands = imports.commands;
var tabs = imports.tabManager; var tabs = imports.tabManager;
@ -30,16 +29,14 @@ define(function(require, exports, module) {
var originalLine, originalColumn, control, lastLine, lineControl; var originalLine, originalColumn, control, lastLine, lineControl;
var nohide, originalPath; var nohide, originalPath;
var win, input, list, model; // ui elements var win, input, list, lines; // ui elements
var loaded = false, changed = false; var loaded = false, changed = false;
function load() { function load() {
if (loaded) return false; if (loaded) return false;
loaded = true; loaded = true;
model = new ui.model(); menus.addItemByPath("Goto/Goto Line...", new ui.item({
menus.addItemByPath("Goto/Goto Line...", new apf.item({
caption: "Goto Line...", caption: "Goto Line...",
hint: "enter a line number and jump to it in the active document", hint: "enter a line number and jump to it in the active document",
command: "gotoline" command: "gotoline"
@ -78,14 +75,11 @@ define(function(require, exports, module) {
lines = lines.map(function(i) { lines = lines.map(function(i) {
return { value: i }; return { value: i };
}); });
model.load(lines);
}, plugin); }, plugin);
settings.on("write", function() { settings.on("write", function() {
if (changed) { if (changed) {
var lines = (model.data || []).map(function(n) {
return n.value;
});
settings.setJson("state/gotoline", lines); settings.setJson("state/gotoline", lines);
changed = false; changed = false;
} }
@ -111,7 +105,7 @@ define(function(require, exports, module) {
input = plugin.getElement("input"); input = plugin.getElement("input");
list = plugin.getElement("list"); list = plugin.getElement("list");
list.setAttribute("model", model); // list.setAttribute("model", model);
list.addEventListener("afterchoose", function() { list.addEventListener("afterchoose", function() {
if (list.selected) { if (list.selected) {
@ -324,20 +318,14 @@ define(function(require, exports, module) {
}); });
} }
else { else {
//win.hide();
hide(); hide();
var lineNode = model.queryNode("line[@nr='" + line + "']");
if (!lineNode) { var i = lines.indexOf(line);
lineNode = ui.n("<line />") if (i != -1)
.attr("nr", line) lines.splice(i, 1);
.node();
} if (i) {
lines.unshift(line);
var pNode = model.data;
if (lineNode != pNode.firstChild) {
apf.xmldb.appendChild(pNode, lineNode, pNode.firstChild);
changed = true; changed = true;
settings.save(); settings.save();
} }

Wyświetl plik

@ -11,10 +11,7 @@
<a:vbox top="0" right="0" bottom="0" width="61" padding="0" edge="5"> <a:vbox top="0" right="0" bottom="0" width="61" padding="0" edge="5">
<a:textbox id="input" focusselect="true" /> <a:textbox id="input" focusselect="true" />
<a:list id="list" <a:list id="list"
flex = "1" flex = "1" />
autoselect = "false"
multiselect = "false"
empty-message = "empty" />
</a:vbox> </a:vbox>
</a:bar> </a:bar>
</a:application> </a:application>

Wyświetl plik

@ -630,8 +630,7 @@ apf.dropdown = function(struct, tagName) {
this.$container.host = this; this.$container.host = this;
//Set up the popup //Set up the popup
this.$pHtmlDoc = apf.popup.setContent(this.$uniqueId, this.oSlider, this.$pHtmlDoc = apf.popup.setContent(this.$uniqueId, this.oSlider);
apf.skins.getCssString(this.skinName));
//Get Options form skin //Get Options form skin
//Types: 1=One dimensional List, 2=Two dimensional List //Types: 1=One dimensional List, 2=Two dimensional List

Wyświetl plik

@ -1,3 +1,4 @@
/*global apf*/
define(function(require, module, exports) { define(function(require, module, exports) {
main.consumes = ["Plugin", "apf"]; main.consumes = ["Plugin", "apf"];
main.provides = ["ui"]; main.provides = ["ui"];