blob: 6c2cbb56ba7fcf364088e023c01902fcaa06c06c [file] [log] [blame]
Kasper Nilsson84e63a92017-09-12 14:15:44 -07001<!--
Dave Borowitz8cdc76b2018-03-26 10:04:27 -04002@license
Kasper Nilsson84e63a92017-09-12 14:15:44 -07003Copyright (C) 2017 The Android Open Source Project
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16-->
17
Ole Rehmsen31640742019-05-16 11:24:47 +020018<link rel="import" href="/bower_components/polymer/polymer.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070019
20<link rel="import" href="../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html">
21<link rel="import" href="../../../behaviors/gr-path-list-behavior/gr-path-list-behavior.html">
22<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
23<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
Kasper Nilssoncaf31c12017-10-25 15:18:09 -070024<link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
25<link rel="import" href="../../plugins/gr-endpoint-param/gr-endpoint-param.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070026<link rel="import" href="../../shared/gr-button/gr-button.html">
27<link rel="import" href="../../shared/gr-editable-label/gr-editable-label.html">
Becky Siegel377e2892018-03-15 19:34:49 +000028<link rel="import" href="../../shared/gr-fixed-panel/gr-fixed-panel.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070029<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
Kasper Nilssonaa4a07e2018-04-03 16:14:47 -070030<link rel="import" href="../../shared/gr-storage/gr-storage.html">
Kasper Nilsson88191142017-12-19 14:54:15 -080031<link rel="import" href="../gr-default-editor/gr-default-editor.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070032<link rel="import" href="../../../styles/shared-styles.html">
33
Kasper Nilsson84e63a92017-09-12 14:15:44 -070034<dom-module id="gr-editor-view">
35 <template>
36 <style include="shared-styles">
37 :host {
38 background-color: var(--view-background-color);
39 }
Becky Siegel377e2892018-03-15 19:34:49 +000040 gr-fixed-panel {
Kasper Nilsson76b0f732018-04-17 14:49:00 +020041 background-color: var(--edit-mode-background-color);
Kasper Nilssonc8280982018-04-11 15:32:06 -070042 border-bottom: 1px var(--border-color) solid;
Kasper Nilssonea00f8c2018-01-03 10:25:44 -080043 z-index: 1;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070044 }
45 header,
46 .subHeader {
47 align-items: center;
48 display: flex;
49 justify-content: space-between;
50 padding: .75em var(--default-horizontal-margin);
51 }
52 header gr-editable-label {
Kasper Nilsson122f8982018-02-09 13:46:50 -080053 font-size: var(--font-size-large);
Kasper Nilsson2e15ea22018-02-05 13:42:36 -080054 --label-style: {
55 text-overflow: initial;
56 white-space: initial;
57 word-break: break-all;
58 }
59 --input-style: {
60 margin-top: 1em;
61 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070062 }
63 .textareaWrapper {
Kasper Nilssonc8280982018-04-11 15:32:06 -070064 border: 1px solid var(--border-color);
Kasper Nilsson6cf89972018-01-30 17:23:54 -080065 border-radius: 3px;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070066 margin: var(--default-horizontal-margin);
67 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070068 .textareaWrapper .editButtons {
69 display: none;
70 }
Kasper Nilsson122f8982018-02-09 13:46:50 -080071 .controlGroup {
72 align-items: center;
73 display: flex;
74 font-size: var(--font-size-large);
75 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070076 .rightControls {
Kasper Nilsson6cf89972018-01-30 17:23:54 -080077 justify-content: flex-end;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070078 }
Kasper Nilsson2e15ea22018-02-05 13:42:36 -080079 @media screen and (max-width: 50em) {
80 header,
81 .subHeader {
82 display: block;
83 }
84 .rightControls {
85 float: right;
86 }
87 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070088 </style>
Becky Siegel377e2892018-03-15 19:34:49 +000089 <gr-fixed-panel keep-on-scroll>
Kasper Nilsson84e63a92017-09-12 14:15:44 -070090 <header>
Kasper Nilsson122f8982018-02-09 13:46:50 -080091 <span class="controlGroup">
92 <span>Edit mode</span>
93 <span class="separator"></span>
94 <gr-editable-label
95 label-text="File path"
96 value="[[_path]]"
97 placeholder="File path..."
98 on-changed="_handlePathChanged"></gr-editable-label>
99 </span>
100 <span class="controlGroup rightControls">
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700101 <gr-button
Kasper Nilsson5c6a5cd2018-01-18 16:41:59 -0800102 id="close"
103 link
104 on-tap="_handleCloseTap">Close</gr-button>
105 <gr-button
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700106 id="save"
107 disabled$="[[_saveDisabled]]"
108 primary
Kasper Nilsson5c6a5cd2018-01-18 16:41:59 -0800109 link
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700110 on-tap="_saveEdit">Save</gr-button>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700111 </span>
112 </header>
Becky Siegel377e2892018-03-15 19:34:49 +0000113 </gr-fixed-panel>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700114 <div class="textareaWrapper">
Kasper Nilsson6c39ab92017-12-14 15:41:00 -0800115 <gr-endpoint-decorator id="editorEndpoint" name="editor">
Kasper Nilssonbb7ae962017-12-12 15:05:22 -0800116 <gr-endpoint-param name="fileContent" value="[[_newContent]]"></gr-endpoint-param>
117 <gr-endpoint-param name="prefs" value="[[_prefs]]"></gr-endpoint-param>
118 <gr-endpoint-param name="fileType" value="[[_type]]"></gr-endpoint-param>
Kasper Nilsson88191142017-12-19 14:54:15 -0800119 <gr-default-editor id="file" file-content="[[_newContent]]"></gr-default-editor>
Kasper Nilssoncaf31c12017-10-25 15:18:09 -0700120 </gr-endpoint-decorator>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700121 </div>
122 <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
Kasper Nilssonaa4a07e2018-04-03 16:14:47 -0700123 <gr-storage id="storage"></gr-storage>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700124 </template>
125 <script src="gr-editor-view.js"></script>
Dave Borowitz8cdc76b2018-03-26 10:04:27 -0400126</dom-module>