Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可编辑div补充粘贴逻辑&&计划任务没有【执行历史】时展示调整 #7156

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
this.handleInputBlur()
}
}
divInputDom.addEventListener('paste', this.handlePaste)
},
beforeDestroy () {
window.removeEventListener('click', this.handleListShow, false)
Expand Down Expand Up @@ -476,6 +477,28 @@
handleBlur () {
this.emit_event(this.tagCode, 'blur', this.value)
this.$emit('blur', this.value)
},
handlePaste (e) {
event.preventDefault()
let text = ''
const clp = (e.originalEvent || e).clipboardData
if (clp === undefined || clp === null) {
text = window.clipboardData.getData('text') || ''
text = text.split('\n').join('')
if (text !== '') {
if (window.getSelection) {
const newNode = document.createElement('span')
newNode.innerHTML = text
window.getSelection().getRangeAt(0).insertNode(newNode)
} else {
document.selection.createRange().pasteHTML(text)
}
}
} else {
text = clp.getData('text/plain') || ''
text = text.split('\n').join('')
text && document.execCommand('insertText', false, text)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
divInputDom.innerHTML = divInputDom.innerHTML.replace(/<br>/g, '<div><br></div>')
}
}
divInputDom.addEventListener('paste', this.handlePaste)
},
beforeDestroy () {
window.removeEventListener('click', this.handleListShow, false)
Expand Down Expand Up @@ -465,6 +466,26 @@
handleBlur () {
this.emit_event(this.tagCode, 'blur', this.value)
this.$emit('blur', this.value)
},
handlePaste (e) {
event.preventDefault()
let text = ''
const clp = (e.originalEvent || e).clipboardData
if (clp === undefined || clp === null) {
text = window.clipboardData.getData('text') || ''
if (text !== '') {
if (window.getSelection) {
const newNode = document.createElement('span')
newNode.innerHTML = text
window.getSelection().getRangeAt(0).insertNode(newNode)
} else {
document.selection.createRange().pasteHTML(text)
}
}
} else {
text = clp.getData('text/plain') || ''
text && document.execCommand('insertText', false, text)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@
</div>
<div
:class="['palette-item', 'entry-item', 'palette-with-menu']"
data-type="tasknode"
@mousedown="onNodeMouseDown('plugin', $event)">
data-type="tasknode">
<div class="node-type-icon common-icon-node-tasknode"></div>
</div>
<div
:class="['palette-item','entry-item', 'palette-with-menu']"
data-type="subflow"
@mousedown="onNodeMouseDown('subflow', $event)">
data-type="subflow">
<div class="node-type-icon common-icon-node-subflow"></div>
</div>
<div class="palette-item entry-item" data-config-name="" data-type="parallelgateway">
Expand Down
3 changes: 2 additions & 1 deletion frontend/desktop/src/config/i18n/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,8 @@ const cn = {
'节点输出型变量仅支持从节点"取消接收输出"来删除': '节点输出型变量仅支持从节点"取消接收输出"来删除',
'刷新': '刷新',
'exFailedText': '节点执行失败,请前往{0}查看错误原因',
'exFailedText_调用日志': '调用日志'
'exFailedText_调用日志': '调用日志',
'任务还未执行,暂无执行历史': '任务还未执行,暂无执行历史'
}

export default cn
3 changes: 2 additions & 1 deletion frontend/desktop/src/config/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,8 @@ const en = {
'节点输出型变量仅支持从节点"取消接收输出"来删除': 'Node output variables can only be deleted by the node "Cancel Receiving Output"',
'刷新': 'Refresh',
'exFailedText': 'Node execution failed. Please go to the {0} to check the error reason.',
'exFailedText_调用日志': 'call log'
'exFailedText_调用日志': 'call log',
'任务还未执行,暂无执行历史': 'Task not executed, no history available.'
}

export default en
4 changes: 3 additions & 1 deletion frontend/desktop/src/pages/task/ClockedList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
{{ $t('执行历史') }}
</router-link>
</template>
<span v-else class="empty-text">{{ '--' }}</span>
<span v-else class="empty-text" v-bk-tooltips="$t('任务还未执行,暂无执行历史')">{{ $t('执行历史') }}</span>
</div>
</bk-table-column>
<bk-table-column type="setting">
Expand Down Expand Up @@ -745,6 +745,8 @@
}
.empty-text {
padding: 5px;
color: #ccc;
cursor: not-allowed;
}
}
</style>
Loading