blob: a217fb43e79df1cb8169ad004dfb23c585097d34 [file] [log] [blame]
Kasper Nilsson84e63a92017-09-12 14:15:44 -07001<!--
2Copyright (C) 2017 The Android Open Source Project
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15-->
16
17<link rel="import" href="../../../bower_components/polymer/polymer.html">
18
19<link rel="import" href="../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html">
20<link rel="import" href="../../../behaviors/gr-path-list-behavior/gr-path-list-behavior.html">
21<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
22<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
Kasper Nilssoncaf31c12017-10-25 15:18:09 -070023<link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
24<link rel="import" href="../../plugins/gr-endpoint-param/gr-endpoint-param.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070025<link rel="import" href="../../shared/gr-button/gr-button.html">
26<link rel="import" href="../../shared/gr-editable-label/gr-editable-label.html">
27<link rel="import" href="../../shared/gr-fixed-panel/gr-fixed-panel.html">
28<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
Kasper Nilsson88191142017-12-19 14:54:15 -080029<link rel="import" href="../gr-default-editor/gr-default-editor.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070030<link rel="import" href="../../../styles/shared-styles.html">
31
Kasper Nilsson84e63a92017-09-12 14:15:44 -070032<dom-module id="gr-editor-view">
33 <template>
34 <style include="shared-styles">
35 :host {
36 background-color: var(--view-background-color);
37 }
38 gr-fixed-panel {
39 background-color: #fff;
40 border-bottom: 1px #eee solid;
Kasper Nilssonea00f8c2018-01-03 10:25:44 -080041 z-index: 1;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070042 }
43 header,
44 .subHeader {
45 align-items: center;
46 display: flex;
47 justify-content: space-between;
48 padding: .75em var(--default-horizontal-margin);
49 }
50 header gr-editable-label {
Becky Siegele64a1c92018-01-26 14:43:46 -080051 font-size: 1.2rem;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070052 font-weight: bold;
53 }
54 .textareaWrapper {
Kasper Nilsson6cf89972018-01-30 17:23:54 -080055 border: 1px solid #ddd;
56 border-radius: 3px;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070057 margin: var(--default-horizontal-margin);
58 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070059 .textareaWrapper .editButtons {
60 display: none;
61 }
62 .rightControls {
Kasper Nilsson6cf89972018-01-30 17:23:54 -080063 justify-content: flex-end;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070064 }
65 </style>
Kasper Nilssoneff32262018-01-03 11:24:11 -080066 <gr-fixed-panel keep-on-scroll>
Kasper Nilsson84e63a92017-09-12 14:15:44 -070067 <header>
68 <gr-editable-label
69 label-text="File path"
70 value="[[_path]]"
71 placeholder="File path..."
72 on-changed="_handlePathChanged"></gr-editable-label>
73 <span class="rightControls">
74 <gr-button
Kasper Nilsson5c6a5cd2018-01-18 16:41:59 -080075 id="close"
76 link
77 on-tap="_handleCloseTap">Close</gr-button>
78 <gr-button
Kasper Nilsson84e63a92017-09-12 14:15:44 -070079 id="save"
80 disabled$="[[_saveDisabled]]"
81 primary
Kasper Nilsson5c6a5cd2018-01-18 16:41:59 -080082 link
Kasper Nilsson84e63a92017-09-12 14:15:44 -070083 on-tap="_saveEdit">Save</gr-button>
Kasper Nilsson84e63a92017-09-12 14:15:44 -070084 </span>
85 </header>
86 </gr-fixed-panel>
87 <div class="textareaWrapper">
Kasper Nilsson6c39ab92017-12-14 15:41:00 -080088 <gr-endpoint-decorator id="editorEndpoint" name="editor">
Kasper Nilssonbb7ae962017-12-12 15:05:22 -080089 <gr-endpoint-param name="fileContent" value="[[_newContent]]"></gr-endpoint-param>
90 <gr-endpoint-param name="prefs" value="[[_prefs]]"></gr-endpoint-param>
91 <gr-endpoint-param name="fileType" value="[[_type]]"></gr-endpoint-param>
Kasper Nilsson88191142017-12-19 14:54:15 -080092 <gr-default-editor id="file" file-content="[[_newContent]]"></gr-default-editor>
Kasper Nilssoncaf31c12017-10-25 15:18:09 -070093 </gr-endpoint-decorator>
Kasper Nilsson84e63a92017-09-12 14:15:44 -070094 </div>
95 <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
96 </template>
97 <script src="gr-editor-view.js"></script>
98</dom-module>