Skip to content

Commit

Permalink
Working colours
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsOnlyBinary committed Nov 28, 2024
1 parent dbf64a6 commit 491f29c
Show file tree
Hide file tree
Showing 15 changed files with 1,348 additions and 316 deletions.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
"@fortawesome/free-regular-svg-icons": "^6.7.1",
"@fortawesome/free-solid-svg-icons": "^6.7.1",
"@fortawesome/vue-fontawesome": "^3.0.8",
"@lexical/code": "^0.20.0",
"@lexical/history": "^0.20.0",
"@lexical/html": "^0.20.0",
"@lexical/plain-text": "^0.20.0",
"@lexical/rich-text": "^0.20.0",
"@lexical/selection": "^0.20.0",
"@lexical/utils": "^0.20.0",
"buffer": "^6.0.3",
"compare-versions": "^6.1.1",
"css-vars-ponyfill": "^2.4.9",
Expand All @@ -31,6 +38,7 @@
"ip-regex": "^5.0.0",
"irc-framework": "^4.14.0",
"json5": "^2.2.3",
"lexical": "^0.20.0",
"lodash": "^4.17.21",
"murmurhash3js": "^3.0.1",
"sockjs-client": "^1.6.1",
Expand Down
7 changes: 7 additions & 0 deletions src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ html, body, #kiwiirc {
overflow: hidden;
}
@supports (font-size: round(nearest, 90%, 1px)) and (line-height: round(nearest, 1.6em, 1px)) {
.kiwi-wrap {
font-size: ~'round(nearest, 90%, 1px)';
line-height: ~'round(nearest, 1.6em, 1px)';
}
}
/* .kiwi-workspace has ::before and ::after 4px above itself for the connection status */
.kiwi-workspace {
position: relative;
Expand Down
34 changes: 19 additions & 15 deletions src/components/ControlInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@
v-if="shouldShowColorPicker"
class="kiwi-controlinput-button"
@click.prevent="onToolClickTextStyle"
@mousedown.prevent
>
<svg-icon icon="fa-solid fa-circle-half-stroke" />
<svg-icon icon="fa-solid fa-palette" />
</div>
<div
v-if="shouldShowEmojiPicker"
class="kiwi-controlinput-button"
@click.prevent="onToolClickEmoji"
@mousedown.prevent
>
<svg-icon icon="fa-regular fa-face-smile" />
</div>
Expand Down Expand Up @@ -156,6 +158,7 @@ import * as settingTools from '@/libs/settingTools';
import NewIrcInput from '@/components/utils/NewIrcInput';
import autocompleteCommands from '@/res/autocompleteCommands';
import GlobalApi from '@/libs/GlobalApi';
import { html2irc } from '@/helpers/Html2Irc';
import AutoComplete from './AutoComplete';
import ToolTextStyle from './inputtools/TextStyle';
import ToolEmoji from './inputtools/Emoji';
Expand Down Expand Up @@ -406,13 +409,13 @@ export default {
}
},
toggleBold() {
this.$refs.input.toggleBold();
this.$refs.input.toggleStyle('bold');
},
toggleItalic() {
this.$refs.input.toggleItalic();
this.$refs.input.toggleStyle('italic');
},
toggleUnderline() {
this.$refs.input.toggleUnderline();
this.$refs.input.toggleStyle('underline');
},
onAutocompleteCancel() {
this.autocomplete_open = false;
Expand Down Expand Up @@ -449,14 +452,7 @@ export default {
this.$refs.autocomplete.selectCurrentItem();
}
if (event.key === 'Enter' && (
(event.altKey && !event.shiftKey && !event.metaKey && !event.ctrlKey) ||
(event.shiftKey && !event.altKey && !event.metaKey && !event.ctrlKey)
)) {
// Add new line when shift+enter or alt+enter is pressed
event.preventDefault();
this.$refs.input.insertText('\n');
} else if (event.key === 'Enter') {
if (event.key === 'Enter' && !event.shiftKey && !event.altKey) {
// Send message when enter is pressed
event.preventDefault();
this.submitForm();
Expand Down Expand Up @@ -603,8 +599,8 @@ export default {
this.autocomplete_filter = currentToken;
}
},
async submitForm() {
let rawInput = await this.$refs.input.getValue();
submitForm() {
let rawInput = this.$refs.input.getValue();
if (!rawInput) {
if (!this.has_focus && this.keep_focus) {
// Maybe triggered by the send button on empty input,
Expand All @@ -614,7 +610,9 @@ export default {
return;
}
let ircText = this.$refs.input.buildIrcText();
console.log('raw', JSON.stringify(rawInput));

Check warning on line 613 in src/components/ControlInput.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
let ircText = html2irc(rawInput);
console.log('irc', JSON.stringify(ircText));

Check warning on line 615 in src/components/ControlInput.vue

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
// Show a warning if a command is preceded by spaces
let warnExpectedCommand = this.$state.setting('buffers.warn_expected_command');
Expand Down Expand Up @@ -1022,6 +1020,12 @@ export default {
cursor: pointer;
justify-content: center;
align-items: center;
position: relative;
.kiwi-controlinput-button-clicker {
position: absolute;
inset: 0;
}
svg {
font-size: 20px;
Expand Down
12 changes: 4 additions & 8 deletions src/components/inputtools/Emoji.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
v-for="(text, eCode) in emojis"
:key="eCode"
:style="{'background-image':`url(${location}${eCode})`}"
:data-code="text"
:data-ascii="text"
class="kiwi-inputtool-emoji-emoji"
@click="onImgClick"
/>
Expand All @@ -17,7 +17,7 @@
'kiwi public';
import _ from 'lodash';
import * as Misc from '@/helpers/Misc';
import * as EmojiProvider from '@/libs/EmojiProvider.js';
export default {
props: ['ircinput'],
Expand All @@ -40,12 +40,8 @@ export default {
},
methods: {
onImgClick: function onImgClick(event) {
let url = window.getComputedStyle(event.target, null)
.getPropertyValue('background-image');
url = Misc.extractURL(url);
let code = event.target.dataset.code;
this.ircinput.addImg(code, url);
const [emoji] = EmojiProvider.getEmojis(event.target.dataset.ascii);
this.ircinput.addEmoji(emoji);
},
},
};
Expand Down
Loading

0 comments on commit 491f29c

Please sign in to comment.