wip
This commit is contained in:
parent
abf1c30ce6
commit
73029df58a
|
@ -42,7 +42,10 @@ export type API = {
|
|||
default?: string;
|
||||
}) => Promise<string>;
|
||||
|
||||
post: () => void;
|
||||
post: (opts?: {
|
||||
reply?: any;
|
||||
repost?: any;
|
||||
}) => void;
|
||||
|
||||
notify: (message: string) => void;
|
||||
};
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
import PostFormWindow from '../views/components/post-form-window.vue';
|
||||
import RepostFormWindow from '../views/components/repost-form-window.vue';
|
||||
|
||||
export default function() {
|
||||
const vm = new PostFormWindow().$mount();
|
||||
document.body.appendChild(vm.$el);
|
||||
export default function(opts) {
|
||||
const o = opts || {};
|
||||
if (o.repost) {
|
||||
const vm = new RepostFormWindow({
|
||||
propsData: {
|
||||
repost: o.repost
|
||||
}
|
||||
}).$mount();
|
||||
document.body.appendChild(vm.$el);
|
||||
} else {
|
||||
const vm = new PostFormWindow({
|
||||
propsData: {
|
||||
reply: o.reply
|
||||
}
|
||||
}).$mount();
|
||||
document.body.appendChild(vm.$el);
|
||||
}
|
||||
}
|
||||
|
|
3
src/web/app/mobile/api/notify.ts
Normal file
3
src/web/app/mobile/api/notify.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default function(message) {
|
||||
alert(message);
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
import PostForm from '../views/components/post-form.vue';
|
||||
import RepostForm from '../views/components/repost-form.vue';
|
||||
|
||||
export default function(opts) {
|
||||
const o = opts || {};
|
||||
|
||||
export default opts => {
|
||||
const app = document.getElementById('app');
|
||||
app.style.display = 'none';
|
||||
|
||||
|
@ -7,8 +11,23 @@ export default opts => {
|
|||
app.style.display = 'block';
|
||||
}
|
||||
|
||||
const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0];
|
||||
form
|
||||
.on('cancel', recover)
|
||||
.on('post', recover);
|
||||
};
|
||||
if (o.repost) {
|
||||
const vm = new RepostForm({
|
||||
propsData: {
|
||||
repost: o.repost
|
||||
}
|
||||
}).$mount();
|
||||
vm.$once('cancel', recover);
|
||||
vm.$once('post', recover);
|
||||
document.body.appendChild(vm.$el);
|
||||
} else {
|
||||
const vm = new PostForm({
|
||||
propsData: {
|
||||
reply: o.reply
|
||||
}
|
||||
}).$mount();
|
||||
vm.$once('cancel', recover);
|
||||
vm.$once('post', recover);
|
||||
document.body.appendChild(vm.$el);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ import dialog from './api/dialog';
|
|||
import input from './api/input';
|
||||
import post from './api/post';
|
||||
import notify from './api/notify';
|
||||
import updateAvatar from './api/update-avatar';
|
||||
import updateBanner from './api/update-banner';
|
||||
|
||||
import MkIndex from './views/pages/index.vue';
|
||||
import MkUser from './views/pages/user/user.vue';
|
||||
|
@ -35,15 +33,13 @@ init((launch) => {
|
|||
document.body.setAttribute('ontouchstart', '');
|
||||
|
||||
// Launch the app
|
||||
const [app, os] = launch(os => ({
|
||||
const [app] = launch(os => ({
|
||||
chooseDriveFolder,
|
||||
chooseDriveFile,
|
||||
dialog,
|
||||
input,
|
||||
post,
|
||||
notify,
|
||||
updateAvatar: updateAvatar(os),
|
||||
updateBanner: updateBanner(os)
|
||||
notify
|
||||
}));
|
||||
|
||||
// Routing
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<button class="poll" @click="addPoll">%fa:chart-pie%</button>
|
||||
<input ref="file" type="file" accept="image/*" multiple="multiple" onchange={ changeFile }/>
|
||||
</div>
|
||||
</div
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
Loading…
Reference in a new issue