forked from devsam/core
feat: 턴 조작기에 '텍스트 복사' 추가
This commit is contained in:
@@ -48,19 +48,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</DragSelect>
|
||||
<BButton
|
||||
ref="btnCopy"
|
||||
<div
|
||||
class="hoverPanel d-grid"
|
||||
:style="{
|
||||
position: 'absolute',
|
||||
display: isCopyButtonShown ? 'block' : 'none',
|
||||
display: isCopyButtonShown ? 'grid !important' : 'none !important',
|
||||
top: `${btnPos * 30 + 25}px`,
|
||||
right: '10px',
|
||||
}"
|
||||
@blur="hideCopyButton()"
|
||||
@click="tryCopy()"
|
||||
>
|
||||
복사하기
|
||||
</BButton>
|
||||
<BButton ref="btnCopy" variant="primary" @blur="hideCopyButton()" @click="tryCopy()"> 복사하기 </BButton>
|
||||
<BButton ref="btnCopy" @blur="hideCopyButton()" @click="tryTextCopy()"> 텍스트 복사</BButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@@ -117,7 +116,7 @@ function dragStart() {
|
||||
isDragToggle.value = true;
|
||||
}
|
||||
|
||||
function hideCopyButton(){
|
||||
function hideCopyButton() {
|
||||
setTimeout(() => {
|
||||
isCopyButtonShown.value = false;
|
||||
}, 1);
|
||||
@@ -166,6 +165,25 @@ function tryCopy() {
|
||||
storedActionsHelper.clipboard.value = [...actions];
|
||||
}
|
||||
|
||||
const removeTagRegEx = /<[^>]*>?/g;
|
||||
|
||||
function tryTextCopy() {
|
||||
const actions = queryActionHelper.extractQueryActions();
|
||||
isCopyButtonShown.value = false;
|
||||
|
||||
const turnBriefs: [number, string][] = [];
|
||||
for (const action of actions) {
|
||||
const [turnIdxList, turnObj] = action;
|
||||
for (const turnIdx of turnIdxList) {
|
||||
turnBriefs.push([turnIdx, `${turnIdx + 1}턴 ${turnObj.brief.replace(removeTagRegEx, "")}`]);
|
||||
}
|
||||
}
|
||||
turnBriefs.sort((a, b) => a[0] - b[0]);
|
||||
|
||||
const text = turnBriefs.map(([, brief]) => brief).join("\n");
|
||||
void navigator.clipboard.writeText(text);
|
||||
}
|
||||
|
||||
const turnTimes = ref<string[]>([]);
|
||||
|
||||
if (!props.officer || !props.officer.turnTime) {
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
<BDropdownItem @click="clipboardCopy"> <i class="bi bi-files" /> 복사하기 </BDropdownItem>
|
||||
<BDropdownItem @click="clipboardPaste"> <i class="bi bi-clipboard-fill" /> 붙여넣기 </BDropdownItem>
|
||||
<BDropdownDivider />
|
||||
<BDropdownItem @click="clipboardTextCopy"> <i class="bi bi-files" /> 텍스트 복사 </BDropdownItem>
|
||||
<BDropdownDivider />
|
||||
<BDropdownItem @click="setStoredActions">
|
||||
<i class="bi bi-bookmark-plus-fill" /> 보관하기
|
||||
</BDropdownItem>
|
||||
@@ -640,6 +642,31 @@ async function clipboardPaste(releaseSelect = true) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const removeTagRegEx = /<[^>]*>?/g;
|
||||
|
||||
function clipboardTextCopy(releaseSelect = true) {
|
||||
const rawActions = queryActionHelper.extractQueryActions();
|
||||
if (rawActions.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const turnBriefs: [number, string][] = [];
|
||||
for (const action of rawActions) {
|
||||
const [turnIdxList, turnObj] = action;
|
||||
for (const turnIdx of turnIdxList) {
|
||||
turnBriefs.push([turnIdx, `${turnIdx + 1}턴 ${turnObj.brief.replace(removeTagRegEx, "")}`]);
|
||||
}
|
||||
}
|
||||
turnBriefs.sort((a, b) => a[0] - b[0]);
|
||||
|
||||
const text = turnBriefs.map(([, brief]) => brief).join("\n");
|
||||
void navigator.clipboard.writeText(text);
|
||||
|
||||
if (releaseSelect) {
|
||||
queryActionHelper.releaseSelectedTurnList();
|
||||
}
|
||||
}
|
||||
|
||||
async function subRepeatCommand(releaseSelect = true): Promise<boolean> {
|
||||
const reqTurnList = queryActionHelper.getSelectedTurnList();
|
||||
const selectedMinTurnIdx = reqTurnList[0];
|
||||
|
||||
@@ -225,6 +225,8 @@
|
||||
<i class="bi bi-clipboard-fill" /> 붙여넣기
|
||||
</BDropdownItem>
|
||||
<BDropdownDivider />
|
||||
<BDropdownItem @click="clipboardTextCopy"> <i class="bi bi-files" /> 텍스트 복사 </BDropdownItem>
|
||||
<BDropdownDivider />
|
||||
<BDropdownItem @click="setStoredActions">
|
||||
<i class="bi bi-bookmark-plus-fill" /> 보관하기
|
||||
</BDropdownItem>
|
||||
@@ -621,6 +623,32 @@ async function clipboardPaste(releaseSelect = true) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const removeTagRegEx = /<[^>]*>?/g;
|
||||
|
||||
function clipboardTextCopy(releaseSelect = true) {
|
||||
const rawActions = queryActionHelper.extractQueryActions();
|
||||
if (rawActions.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const turnBriefs: [number, string][] = [];
|
||||
for (const action of rawActions) {
|
||||
const [turnIdxList, turnObj] = action;
|
||||
for (const turnIdx of turnIdxList) {
|
||||
turnBriefs.push([turnIdx, `${turnIdx + 1}턴 ${turnObj.brief.replace(removeTagRegEx, "")}`]);
|
||||
}
|
||||
}
|
||||
turnBriefs.sort((a, b) => a[0] - b[0]);
|
||||
|
||||
const text = turnBriefs.map(([, brief]) => brief).join("\n");
|
||||
void navigator.clipboard.writeText(text);
|
||||
|
||||
if (releaseSelect) {
|
||||
queryActionHelper.releaseSelectedTurnList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function subRepeatCommand(releaseSelect = true): Promise<boolean> {
|
||||
const reqTurnList = queryActionHelper.getSelectedTurnList();
|
||||
const selectedMinTurnIdx = reqTurnList[0];
|
||||
|
||||
Reference in New Issue
Block a user