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