summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/edit/gr-editor-view/gr-editor-view_html.ts
blob: b577db3b72847eacff541738f499ee5c328b78b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/**
 * @license
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import {html} from '@polymer/polymer/lib/utils/html-tag';

export const htmlTemplate = html`
  <style include="shared-styles">
    :host {
      background-color: var(--view-background-color);
    }
    .stickyHeader {
      background-color: var(--edit-mode-background-color);
      border-bottom: 1px var(--border-color) solid;
      position: sticky;
      top: 0;
      z-index: 1;
    }
    header {
      align-items: center;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      padding: var(--spacing-m) var(--spacing-l);
    }
    header gr-editable-label {
      font-family: var(--header-font-family);
      font-size: var(--font-size-h3);
      font-weight: var(--font-weight-h3);
      line-height: var(--line-height-h3);
    }
    header gr-editable-label::part(label) {
      text-overflow: initial;
      white-space: initial;
      word-break: break-all;
    }
    header gr-editable-label::part(input-container) {
      margin-top: var(--spacing-l);
    }
    .textareaWrapper {
      border: 1px solid var(--border-color);
      border-radius: var(--border-radius);
      margin: var(--spacing-l);
    }
    .textareaWrapper .editButtons {
      display: none;
    }
    .controlGroup {
      align-items: center;
      display: flex;
      font-family: var(--header-font-family);
      font-size: var(--font-size-h3);
      font-weight: var(--font-weight-h3);
      line-height: var(--line-height-h3);
    }
    .rightControls {
      justify-content: flex-end;
    }
  </style>
  <div class="stickyHeader">
    <header>
      <span class="controlGroup">
        <span>Edit mode</span>
        <span class="separator"></span>
        <gr-editable-label
          label-text="File path"
          value="[[_path]]"
          placeholder="File path..."
          on-changed="_handlePathChanged"
        ></gr-editable-label>
      </span>
      <span class="controlGroup rightControls">
        <gr-button id="close" link="" on-click="_handleCloseTap"
          >Cancel</gr-button
        >
        <gr-button
          id="save"
          disabled$="[[_saveDisabled]]"
          primary=""
          link=""
          title="Save and Close the file"
          on-click="_handleSaveTap"
          >Save</gr-button
        >
        <gr-button
          id="publish"
          link=""
          primary=""
          title="Publish your edit. A new patchset will be created."
          on-click="_handlePublishTap"
          disabled$="[[_saveDisabled]]"
          >Save & Publish</gr-button
        >
      </span>
    </header>
  </div>
  <div class="textareaWrapper">
    <gr-endpoint-decorator id="editorEndpoint" name="editor">
      <gr-endpoint-param
        name="fileContent"
        value="[[_newContent]]"
      ></gr-endpoint-param>
      <gr-endpoint-param name="prefs" value="[[_prefs]]"></gr-endpoint-param>
      <gr-endpoint-param name="fileType" value="[[_type]]"></gr-endpoint-param>
      <gr-endpoint-param
        name="lineNum"
        value="[[_lineNum]]"
      ></gr-endpoint-param>
      <gr-default-editor
        id="file"
        file-content="[[_newContent]]"
      ></gr-default-editor>
    </gr-endpoint-decorator>
  </div>
`;