Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 1 | <!-- |
Dave Borowitz | 8cdc76b | 2018-03-26 10:04:27 -0400 | [diff] [blame] | 2 | @license |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 3 | Copyright (C) 2017 The Android Open Source Project |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | --> |
| 17 | |
Ole Rehmsen | 3164074 | 2019-05-16 11:24:47 +0200 | [diff] [blame] | 18 | <link rel="import" href="/bower_components/polymer/polymer.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 19 | |
Paladox none | 44b3a7c | 2019-08-06 14:36:29 +0000 | [diff] [blame] | 20 | <link rel="import" href="../../../behaviors/fire-behavior/fire-behavior.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 21 | <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 Nilsson | caf31c1 | 2017-10-25 15:18:09 -0700 | [diff] [blame] | 25 | <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 Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 27 | <link rel="import" href="../../shared/gr-button/gr-button.html"> |
| 28 | <link rel="import" href="../../shared/gr-editable-label/gr-editable-label.html"> |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 29 | <link rel="import" href="../../shared/gr-fixed-panel/gr-fixed-panel.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 30 | <link rel="import" href="../../shared/gr-rest-api-interface/gr-rest-api-interface.html"> |
Kasper Nilsson | aa4a07e | 2018-04-03 16:14:47 -0700 | [diff] [blame] | 31 | <link rel="import" href="../../shared/gr-storage/gr-storage.html"> |
Kasper Nilsson | 8819114 | 2017-12-19 14:54:15 -0800 | [diff] [blame] | 32 | <link rel="import" href="../gr-default-editor/gr-default-editor.html"> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 33 | <link rel="import" href="../../../styles/shared-styles.html"> |
| 34 | |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 35 | <dom-module id="gr-editor-view"> |
| 36 | <template> |
| 37 | <style include="shared-styles"> |
| 38 | :host { |
| 39 | background-color: var(--view-background-color); |
| 40 | } |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 41 | gr-fixed-panel { |
Kasper Nilsson | 76b0f73 | 2018-04-17 14:49:00 +0200 | [diff] [blame] | 42 | background-color: var(--edit-mode-background-color); |
Kasper Nilsson | c828098 | 2018-04-11 15:32:06 -0700 | [diff] [blame] | 43 | border-bottom: 1px var(--border-color) solid; |
Kasper Nilsson | ea00f8c | 2018-01-03 10:25:44 -0800 | [diff] [blame] | 44 | z-index: 1; |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 45 | } |
| 46 | header, |
| 47 | .subHeader { |
| 48 | align-items: center; |
| 49 | display: flex; |
| 50 | justify-content: space-between; |
Ben Rohlfs | b3d95cf | 2019-10-20 19:26:48 +0200 | [diff] [blame] | 51 | padding: var(--spacing-m) var(--spacing-l); |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 52 | } |
| 53 | header gr-editable-label { |
Ben Rohlfs | 9f4e987 | 2019-10-20 22:14:14 +0200 | [diff] [blame] | 54 | font-size: var(--font-size-h3); |
Kasper Nilsson | 2e15ea2 | 2018-02-05 13:42:36 -0800 | [diff] [blame] | 55 | --label-style: { |
| 56 | text-overflow: initial; |
| 57 | white-space: initial; |
| 58 | word-break: break-all; |
| 59 | } |
| 60 | --input-style: { |
Ben Rohlfs | b3d95cf | 2019-10-20 19:26:48 +0200 | [diff] [blame] | 61 | margin-top: var(--spacing-l); |
Kasper Nilsson | 2e15ea2 | 2018-02-05 13:42:36 -0800 | [diff] [blame] | 62 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 63 | } |
| 64 | .textareaWrapper { |
Kasper Nilsson | c828098 | 2018-04-11 15:32:06 -0700 | [diff] [blame] | 65 | border: 1px solid var(--border-color); |
Ben Rohlfs | 4415e6b | 2019-10-29 08:46:43 +0100 | [diff] [blame] | 66 | border-radius: var(--border-radius); |
Ben Rohlfs | b3d95cf | 2019-10-20 19:26:48 +0200 | [diff] [blame] | 67 | margin: var(--spacing-l); |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 68 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 69 | .textareaWrapper .editButtons { |
| 70 | display: none; |
| 71 | } |
Kasper Nilsson | 122f898 | 2018-02-09 13:46:50 -0800 | [diff] [blame] | 72 | .controlGroup { |
| 73 | align-items: center; |
| 74 | display: flex; |
Ben Rohlfs | 9f4e987 | 2019-10-20 22:14:14 +0200 | [diff] [blame] | 75 | font-size: var(--font-size-h3); |
Kasper Nilsson | 122f898 | 2018-02-09 13:46:50 -0800 | [diff] [blame] | 76 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 77 | .rightControls { |
Kasper Nilsson | 6cf8997 | 2018-01-30 17:23:54 -0800 | [diff] [blame] | 78 | justify-content: flex-end; |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 79 | } |
Kasper Nilsson | 2e15ea2 | 2018-02-05 13:42:36 -0800 | [diff] [blame] | 80 | @media screen and (max-width: 50em) { |
| 81 | header, |
| 82 | .subHeader { |
| 83 | display: block; |
| 84 | } |
| 85 | .rightControls { |
| 86 | float: right; |
| 87 | } |
| 88 | } |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 89 | </style> |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 90 | <gr-fixed-panel keep-on-scroll> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 91 | <header> |
Kasper Nilsson | 122f898 | 2018-02-09 13:46:50 -0800 | [diff] [blame] | 92 | <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 Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 102 | <gr-button |
Kasper Nilsson | 5c6a5cd | 2018-01-18 16:41:59 -0800 | [diff] [blame] | 103 | id="close" |
| 104 | link |
Milutin Kristofic | 63cf95d | 2019-09-27 15:41:53 +0200 | [diff] [blame] | 105 | on-click="_handleCloseTap">Close</gr-button> |
Kasper Nilsson | 5c6a5cd | 2018-01-18 16:41:59 -0800 | [diff] [blame] | 106 | <gr-button |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 107 | id="save" |
| 108 | disabled$="[[_saveDisabled]]" |
| 109 | primary |
Kasper Nilsson | 5c6a5cd | 2018-01-18 16:41:59 -0800 | [diff] [blame] | 110 | link |
Milutin Kristofic | 63cf95d | 2019-09-27 15:41:53 +0200 | [diff] [blame] | 111 | on-click="_saveEdit">Save</gr-button> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 112 | </span> |
| 113 | </header> |
Becky Siegel | 377e289 | 2018-03-15 19:34:49 +0000 | [diff] [blame] | 114 | </gr-fixed-panel> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 115 | <div class="textareaWrapper"> |
Kasper Nilsson | 6c39ab9 | 2017-12-14 15:41:00 -0800 | [diff] [blame] | 116 | <gr-endpoint-decorator id="editorEndpoint" name="editor"> |
Kasper Nilsson | bb7ae96 | 2017-12-12 15:05:22 -0800 | [diff] [blame] | 117 | <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 none | 235f9cc | 2020-03-04 15:22:07 +0000 | [diff] [blame] | 120 | <gr-endpoint-param name="lineNum" value="[[_lineNum]]"></gr-endpoint-param> |
Kasper Nilsson | 8819114 | 2017-12-19 14:54:15 -0800 | [diff] [blame] | 121 | <gr-default-editor id="file" file-content="[[_newContent]]"></gr-default-editor> |
Kasper Nilsson | caf31c1 | 2017-10-25 15:18:09 -0700 | [diff] [blame] | 122 | </gr-endpoint-decorator> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 123 | </div> |
| 124 | <gr-rest-api-interface id="restAPI"></gr-rest-api-interface> |
Kasper Nilsson | aa4a07e | 2018-04-03 16:14:47 -0700 | [diff] [blame] | 125 | <gr-storage id="storage"></gr-storage> |
Kasper Nilsson | 84e63a9 | 2017-09-12 14:15:44 -0700 | [diff] [blame] | 126 | </template> |
| 127 | <script src="gr-editor-view.js"></script> |
Dave Borowitz | 8cdc76b | 2018-03-26 10:04:27 -0400 | [diff] [blame] | 128 | </dom-module> |