Created by marc on 4/15/15.
| 15 | * Created by marc on 4/15/15. |
| 16 | */ |
| 17 | public class InternalCSS extends Box { |
| 18 | |
| 19 | static public final Dict.Prop<String> css = new Dict.Prop<>("css").toCanon(); |
| 20 | |
| 21 | static |
| 22 | { |
| 23 | IO.persist(css); |
| 24 | FieldBox.fieldBox.io.addFilespec("css", ".css", "css"); |
| 25 | } |
| 26 | |
| 27 | public InternalCSS() |
| 28 | { |
| 29 | properties.put(Commands.commands, () -> { |
| 30 | Map<Pair<String, String>, Runnable> m = new LinkedHashMap<>(); |
| 31 | RemoteEditor ed = this.find(RemoteEditor.editor, both()).findFirst().get(); |
| 32 | |
| 33 | Box box = ed.getCurrentlyEditing(); |
| 34 | Dict.Prop<String> cep = ed.getCurrentlyEditingProperty(); |
| 35 | |
| 36 | if (box == null) return m; |
| 37 | |
| 38 | if (!cep.equals(css) && (box.first(css, box.upwards()).isPresent())) |
| 39 | m.put(new Pair<>("Edit <i>CSS</i>", "Switch to editing css file associated with this box. You can inject this css into a browser with `_.injectCSS(_.css)`. So, for example, `_.textEditor.injectCSS(_.css)` will dump the css in this box into the `_.textEditor`"), () -> { |
| 40 | ed.setCurrentlyEditingProperty(css); |
| 41 | }); |
| 42 | return m; |
| 43 | }); |
| 44 | } |
| 45 | |
| 46 | } |
nothing calls this directly
no test coverage detected