1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-25 15:46:39 +09:00
This commit is contained in:
syuilo 2017-02-20 10:44:44 +09:00
parent 91d8ee5a52
commit a9dfe278f8
5 changed files with 29 additions and 23 deletions

View File

@ -97,7 +97,6 @@
"gulp-babel": "6.1.2", "gulp-babel": "6.1.2",
"gulp-cssnano": "2.1.2", "gulp-cssnano": "2.1.2",
"gulp-imagemin": "3.1.1", "gulp-imagemin": "3.1.1",
"gulp-livescript": "3.0.1",
"gulp-pug": "3.2.0", "gulp-pug": "3.2.0",
"gulp-rename": "1.2.2", "gulp-rename": "1.2.2",
"gulp-replace": "0.5.4", "gulp-replace": "0.5.4",
@ -109,7 +108,6 @@
"is-root": "1.0.0", "is-root": "1.0.0",
"is-url": "1.2.2", "is-url": "1.2.2",
"js-yaml": "3.8.0", "js-yaml": "3.8.0",
"livescript": "1.5.0",
"mime-types": "2.1.14", "mime-types": "2.1.14",
"mocha": "3.2.0", "mocha": "3.2.0",
"mongodb": "2.2.24", "mongodb": "2.2.24",

View File

@ -128,17 +128,17 @@
this.upload(item.getAsFile()); this.upload(item.getAsFile());
} }
} }
} };
this.onkeypress = (e) => { this.onkeypress = (e) => {
if ((e.which == 10 || e.which == 13) && e.ctrlKey) { if ((e.which == 10 || e.which == 13) && e.ctrlKey) {
this.send(); this.send();
} }
} };
this.selectFile = () => { this.selectFile = () => {
this.refs.file.click(); this.refs.file.click();
} };
this.selectFileFromDrive = () => { this.selectFileFromDrive = () => {
const browser = document.body.appendChild(document.createElement('mk-select-file-from-drive-window')); const browser = document.body.appendChild(document.createElement('mk-select-file-from-drive-window'));
@ -150,7 +150,7 @@
event.one('selected', files => { event.one('selected', files => {
files.forEach(this.addFile); files.forEach(this.addFile);
}); });
} };
this.send = () => { this.send = () => {
this.sending = true; this.sending = true;
@ -165,11 +165,12 @@
this.sending = false; this.sending = false;
this.update(); this.update();
}); });
};
this.clear = () => { this.clear = () => {
this.refs.text.value = ''; this.refs.text.value = '';
this.files = []; this.files = [];
this.update(); this.update();
} };
</script> </script>
</mk-messaging-form> </mk-messaging-form>

View File

@ -303,7 +303,7 @@
this.history = history; this.history = history;
this.update(); this.update();
}); });
} });
this.search = () => { this.search = () => {
const q = this.refs.search.value; const q = this.refs.search.value;
@ -322,14 +322,16 @@
this.update(); this.update();
.catch (err) => .catch (err) =>
console.error err console.error err
};
this.on-search-keydown = (e) => { this.on-search-keydown = e => {
key = e.which const key = e.which;
switch (key) switch (key)
| 9, 40 => // Key[TAB] or Key[↓] | 9, 40 => // Key[TAB] or Key[↓]
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.refs.search-result.childNodes[0].focus(); this.refs.search-result.childNodes[0].focus();
};
this.on-search-result-keydown = (i, e) => { this.on-search-result-keydown = (i, e) => {
key = e.which key = e.which
@ -350,6 +352,7 @@
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
(this.refs.search-result.childNodes[i].next-element-sibling || this.refs.search-result.childNodes[0]).focus(); (this.refs.search-result.childNodes[i].next-element-sibling || this.refs.search-result.childNodes[0]).focus();
};
</script> </script>
</mk-messaging> </mk-messaging>

View File

@ -206,25 +206,29 @@
this.mixin('i'); this.mixin('i');
this.mixin('text'); this.mixin('text');
this.message = this.opts.message this.message = this.opts.message;
@message.is_me = @message.user.id == this.I.id this.message.is_me = this.message.user.id == this.I.id;
this.on('mount', () => { this.on('mount', () => {
if @message.text? if (this.message.text) {
tokens = @analyze @message.text const tokens = this.analyze(this.message.text);
this.refs.text.innerHTML = @compile tokens this.refs.text.innerHTML = this.compile(tokens);
this.refs.text.children.for-each (e) => this.refs.text.children.forEach(e => {
if e.tag-name == 'MK-URL' if (e.tagName == 'MK-URL') riot.mount(e);
riot.mount e });
// URLをプレビュー // URLをプレビュー
tokens tokens
.filter (t) -> t.type == 'link' .filter(t => t.type == 'link')
.map (t) => .map(t => {
this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview' const el = this.refs.text.appendChild(document.createElement('mk-url-preview'));
riot.mount @preview, do riot.mount(el, {
url: t.content url: t.content
});
});
}
});
</script> </script>
</mk-messaging-message> </mk-messaging-message>

View File

@ -31,7 +31,7 @@ module.exports = (config, commit, env) => {
loader: 'riot-tag-loader', loader: 'riot-tag-loader',
query: { query: {
hot: false, hot: false,
type: 'livescript', type: 'es6',
style: 'stylus', style: 'stylus',
expr: false, expr: false,
compact: true, compact: true,