blob: ce90c697640378fb250899b66fb4db5fde4a7729 [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
Paladox none44b3a7c2019-08-06 14:36:29 +000020<link rel="import" href="../../../behaviors/fire-behavior/fire-behavior.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070021<link rel="import" href="../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.html">
22<link rel="import" href="../../../behaviors/gr-path-list-behavior/gr-path-list-behavior.html">
23<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
24<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
Kasper Nilssoncaf31c12017-10-25 15:18:09 -070025<link rel="import" href="../../plugins/gr-endpoint-decorator/gr-endpoint-decorator.html">
26<link rel="import" href="../../plugins/gr-endpoint-param/gr-endpoint-param.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070027<link rel="import" href="../../shared/gr-button/gr-button.html">
28<link rel="import" href="../../shared/gr-editable-label/gr-editable-label.html">
Becky Siegel377e2892018-03-15 19:34:49 +000029<link rel="import" href="../../shared/gr-fixed-panel/gr-fixed-panel.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070030<link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html">
Kasper Nilssonaa4a07e2018-04-03 16:14:47 -070031<link rel="import" href="../../shared/gr-storage/gr-storage.html">
Kasper Nilsson88191142017-12-19 14:54:15 -080032<link rel="import" href="../gr-default-editor/gr-default-editor.html">
Kasper Nilsson84e63a92017-09-12 14:15:44 -070033<link rel="import" href="../../../styles/shared-styles.html">
34
Kasper Nilsson84e63a92017-09-12 14:15:44 -070035<dom-module id="gr-editor-view">
36 <template>
37 <style include="shared-styles">
38 :host {
39 background-color: var(--view-background-color);
40 }
Becky Siegel377e2892018-03-15 19:34:49 +000041 gr-fixed-panel {
Kasper Nilsson76b0f732018-04-17 14:49:00 +020042 background-color: var(--edit-mode-background-color);
Kasper Nilssonc8280982018-04-11 15:32:06 -070043 border-bottom: 1px var(--border-color) solid;
Kasper Nilssonea00f8c2018-01-03 10:25:44 -080044 z-index: 1;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070045 }
46 header,
47 .subHeader {
48 align-items: center;
49 display: flex;
50 justify-content: space-between;
Ben Rohlfsb3d95cf2019-10-20 19:26:48 +020051 padding: var(--spacing-m) var(--spacing-l);
Kasper Nilsson84e63a92017-09-12 14:15:44 -070052 }
53 header gr-editable-label {
Ben Rohlfs9f4e9872019-10-20 22:14:14 +020054 font-size: var(--font-size-h3);
Kasper Nilsson2e15ea22018-02-05 13:42:36 -080055 --label-style: {
56 text-overflow: initial;
57 white-space: initial;
58 word-break: break-all;
59 }
60 --input-style: {
Ben Rohlfsb3d95cf2019-10-20 19:26:48 +020061 margin-top: var(--spacing-l);
Kasper Nilsson2e15ea22018-02-05 13:42:36 -080062 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070063 }
64 .textareaWrapper {
Kasper Nilssonc8280982018-04-11 15:32:06 -070065 border: 1px solid var(--border-color);
Ben Rohlfs4415e6b2019-10-29 08:46:43 +010066 border-radius: var(--border-radius);
Ben Rohlfsb3d95cf2019-10-20 19:26:48 +020067 margin: var(--spacing-l);
Kasper Nilsson84e63a92017-09-12 14:15:44 -070068 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070069 .textareaWrapper .editButtons {
70 display: none;
71 }
Kasper Nilsson122f8982018-02-09 13:46:50 -080072 .controlGroup {
73 align-items: center;
74 display: flex;
Ben Rohlfs9f4e9872019-10-20 22:14:14 +020075 font-size: var(--font-size-h3);
Kasper Nilsson122f8982018-02-09 13:46:50 -080076 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070077 .rightControls {
Kasper Nilsson6cf89972018-01-30 17:23:54 -080078 justify-content: flex-end;
Kasper Nilsson84e63a92017-09-12 14:15:44 -070079 }
Kasper Nilsson2e15ea22018-02-05 13:42:36 -080080 @media screen and (max-width: 50em) {
81 header,
82 .subHeader {
83 display: block;
84 }
85 .rightControls {
86 float: right;
87 }
88 }
Kasper Nilsson84e63a92017-09-12 14:15:44 -070089 </style>
Becky Siegel377e2892018-03-15 19:34:49 +000090 <gr-fixed-panel keep-on-scroll>
Kasper Nilsson84e63a92017-09-12 14:15:44 -070091 <header>
Kasper Nilsson122f8982018-02-09 13:46:50 -080092 <span class="controlGroup">
93 <span>Edit mode</span>
94 <span class="separator"></span>
95 <gr-editable-label
96 label-text="File path"
97 value="[[_path]]"
98 placeholder="File path..."
99 on-changed="_handlePathChanged"></gr-editable-label>
100 </span>
101 <span class="controlGroup rightControls">
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700102 <gr-button
Kasper Nilsson5c6a5cd2018-01-18 16:41:59 -0800103 id="close"
104 link
Milutin Kristofic63cf95d2019-09-27 15:41:53 +0200105 on-click="_handleCloseTap">Close</gr-button>
Kasper Nilsson5c6a5cd2018-01-18 16:41:59 -0800106 <gr-button
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700107 id="save"
108 disabled$="[[_saveDisabled]]"
109 primary
Kasper Nilsson5c6a5cd2018-01-18 16:41:59 -0800110 link
Milutin Kristofic63cf95d2019-09-27 15:41:53 +0200111 on-click="_saveEdit">Save</gr-button>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700112 </span>
113 </header>
Becky Siegel377e2892018-03-15 19:34:49 +0000114 </gr-fixed-panel>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700115 <div class="textareaWrapper">
Kasper Nilsson6c39ab92017-12-14 15:41:00 -0800116 <gr-endpoint-decorator id="editorEndpoint" name="editor">
Kasper Nilssonbb7ae962017-12-12 15:05:22 -0800117 <gr-endpoint-param name="fileContent" value="[[_newContent]]"></gr-endpoint-param>
118 <gr-endpoint-param name="prefs" value="[[_prefs]]"></gr-endpoint-param>
119 <gr-endpoint-param name="fileType" value="[[_type]]"></gr-endpoint-param>
Paladox none235f9cc2020-03-04 15:22:07 +0000120 <gr-endpoint-param name="lineNum" value="[[_lineNum]]"></gr-endpoint-param>
Kasper Nilsson88191142017-12-19 14:54:15 -0800121 <gr-default-editor id="file" file-content="[[_newContent]]"></gr-default-editor>
Kasper Nilssoncaf31c12017-10-25 15:18:09 -0700122 </gr-endpoint-decorator>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700123 </div>
124 <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
Kasper Nilssonaa4a07e2018-04-03 16:14:47 -0700125 <gr-storage id="storage"></gr-storage>
Kasper Nilsson84e63a92017-09-12 14:15:44 -0700126 </template>
127 <script src="gr-editor-view.js"></script>
Dave Borowitz8cdc76b2018-03-26 10:04:27 -0400128</dom-module>