Skip to content

Commit

Permalink
implemented changes for quill ws
Browse files Browse the repository at this point in the history
  • Loading branch information
eyesore- committed Jan 14, 2017
1 parent 1e6c00d commit 71b63c4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 140 deletions.
10 changes: 5 additions & 5 deletions client/js/main_content.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Created by Duncan on 12.29.2016
// Methods for main_content.vue
import Utils from '../js/utils.js';
import _ from 'underscore';
// Methods for main_content.vu
// HTTP calls ect.
import Utils from '../js/utils.js'

module.exports = {
// Function adds each charactor to input
update(e) {
this.input = e.target.value;
this.input = e.target.value
},
wsSend() {
_.debounce(() => { this.ws.send(this.input) }, 500)();
this.ws.send(this.input);
},
// On each keyup counts amount of words on document
wordCounter() {
Expand Down
102 changes: 0 additions & 102 deletions client/vue-components/main_content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
<div class="content">

<div class="content-left">
<<<<<<< HEAD
<p>This area is for live data about text</p>
</div>
<!-- end live data area -->
<!-- text field -->
<div class="content-right float-r">
=======
<VideoComponent id="video" :wsRTC="wsRTC" :answer="answer"></VideoComponent>
<div class="doc-info" v-if="count > 0">
<div>{{ count }} words</div>
Expand All @@ -20,24 +13,7 @@
</div>

<div class="content-right">
<<<<<<< HEAD
<div id="editor"></div>
=======
<!-- Markdown editor -->
<!-- Doesn't really compile markdown yet -->
>>>>>>> d18605cce8f35fc3b8f68f53381b6ac4d2abe005
<div id="editor">
<textarea id="content"
:value="input"
@input="update"
@input.ws-send="wsSend"
@keyup.delete="wordCounter"
@keyup.space="wordCounter"
@keyup.enter="wordCounter(true)">
</textarea>
</div>
<!-- end editor -->
>>>>>>> 724d88a4db4f68b65bf4c6f5fb1500c7b15dd56b
</div>

</div>
Expand All @@ -47,14 +23,7 @@
<script>
import Navbar from './navbar.vue'
import Methods from '../js/main_content.js'
<<<<<<< HEAD
=======
import VideoComponent from './video_component.vue'
<<<<<<< HEAD
=======
// HTTP calls ect.
>>>>>>> d18605cce8f35fc3b8f68f53381b6ac4d2abe005
>>>>>>> 724d88a4db4f68b65bf4c6f5fb1500c7b15dd56b
import Utils from '../js/utils.js'
import {textStats, docSubscribe} from '../js/editor.js'
import sharedb from 'sharedb/lib/client'
Expand All @@ -64,34 +33,14 @@
export default {
created() {
<<<<<<< HEAD
let chance = new Chance()
let c = this.$route.params.channel
this.URI = c !== undefined && /^\w{5}$/.test(c) ? c : chance.word({length: 5})
=======
// get params from URL (if provided)
let c = this.$route.params.channel;
<<<<<<< HEAD
// set URI to params or generated 5 char unique.
let URI = c !== undefined && /^\w{5}$/.test(c) ? c : chance.word({length: 5});
// create websocket with unique address.
this.ws = new WebSocket(`ws:https://${window.location.host}/ws/${URI}`);
// update URL display. I still think we can do this with router somehow :S
window.history.pushState(window.location.origin, '/', URI);
=======
// set URI to params or generated 5 char unique.
let URI = c !== undefined && /^\w{5}$/.test(c) ? c : chance.word({length: 5});
// create websocket with unique address.
this.ws = new WebSocket(`wss:https://${window.location.host}/ws/${URI}`);
>>>>>>> 724d88a4db4f68b65bf4c6f5fb1500c7b15dd56b
//create RTC websocket
this.wsRTC = new WebSocket(`wss:https://${window.location.host}/ws/${this.URI}rtc`);
// update URL display. I still think we can do this with router somehow :S
<<<<<<< HEAD
window.history.pushState(window.location.origin, '/', this.URI);
},
mounted() {
Expand All @@ -101,17 +50,6 @@
// For testing reconnection
window.disconnect = function() {
connection.close();
=======
window.history.pushState(window.location.origin, '/', URI);
>>>>>>> d18605cce8f35fc3b8f68f53381b6ac4d2abe005
// Whenever we receive a message, update textarea
this.ws.onmessage = e => {
if (e.data !== this.input) {
this.input = e.data;
this.wordCounter();
}
>>>>>>> 724d88a4db4f68b65bf4c6f5fb1500c7b15dd56b
}
window.connect = function(URI) {
let socket = new WebSocket(`ws:https://${window.location.host}`);
Expand Down Expand Up @@ -151,7 +89,6 @@
}
</script>

<<<<<<< HEAD
<style scoped>
.main-content{
width: 100vw;
Expand Down Expand Up @@ -187,42 +124,3 @@ code {
color: #f66;
}
</style>
=======
<style>
.main-content{
width: 100vw;
}
.content-right{
width: 70vw;
height: 87vh;
}
.content-left{
position: fixed;
width: 30vw;
}
html, body{
margin: 0;
color: #333;
font-family: 'Monaco', courier, monospace;
}
#editor {
height: 100%
}
textarea, #editor div {
width: 100%;
height: 100%;
vertical-align: top;
padding: 0 20px;
}
textarea {
border: none;
resize: none;
outline: none;
font-size: 1em;
padding: 20px;
}
code {
color: #f66;
}
</style>
>>>>>>> 724d88a4db4f68b65bf4c6f5fb1500c7b15dd56b
42 changes: 22 additions & 20 deletions client/vue-components/navbar.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<!-- Created by Duncan on 12.28.2016 -->
<template>
<nav class="navbar navbar-fixed-top">
<div class="nav-left">
<div class="left-nav">
</div>
<div class="title">
<span>Untitled</span>
<p>Untitled</p>
</div>
<div class="avatar-area">

<!-- can change fullname to image.//size throws an error however it is working?! -->
<avatar fullname="Duncan Nevin" color="rgb(0, 0, 0)" size="20"></avatar>
</div>
</nav>
</template>
Expand All @@ -26,37 +27,38 @@
</script>

<style>
.navbar {
display: inline-flex;
.navbar{
display: table;
z-index: 0;
background-color: rgb(24, 24, 24);
height: 13vh;
margin: 0;
border: none;
}
.nav-left {
display: flex;
width: 30vw;
height: 8em;
width: 100vw;
border: transparent;
}
.title{
display: flex;
width: 50vw;
color: #FFF;
align-items: center;
justify-content: center;
display: table-cell;
height: 100%;
color: rgb(255, 255, 255);
font-weight: normal;
text-align: center;
vertical-align: middle;
}
.avatar-area{
display: table-cell;
text-align: right;
vertical-align: middle;
padding-right: 2em;
}
.avatar{
cursor: pointer;
}
.glyphicon{
color: rgb(255, 255, 255);
}
<<<<<<< HEAD
=======
.left-nav{
position: relative;
display: table-cell;
height: 100%;
width: 30vw;
}
>>>>>>> d18605cce8f35fc3b8f68f53381b6ac4d2abe005
</style>
4 changes: 2 additions & 2 deletions client/vue-components/tool_bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
position: fixed;
display: table-cell;
z-index: 10;
top: 15vh;
top: 8em;
background-color: rgb(54, 54, 54);
display: table-cell;
margin: 0;
Expand Down Expand Up @@ -101,4 +101,4 @@
.left-side:hover .count{
left: 0;
}
</style>
</style>
10 changes: 0 additions & 10 deletions editor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,12 @@ func main() {
// serve index.html to root, or any path we don't recognise.
r.HandleFunc("/", serveIndex)
r.NotFoundHandler = http.HandlerFunc(serveIndex)
<<<<<<< HEAD

// start 'er up.
log.Fatal(http.ListenAndServe(":8000", r))
=======

// start 'er up.
log.Fatal(http.ListenAndServeTLS(PORTSSL, PUBLIC_KEY, PRIV_KEY, r))
// log.Fatal(http.ListenAndServe(":8000", http.HandlerFunc(redirectToHttps)))
}

func serveIndex(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "client/index.html")
>>>>>>> d18605cce8f35fc3b8f68f53381b6ac4d2abe005
}

func serveIndex(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "client/index.html")
}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
// publicPath: 'dist/',
path: './client/dist',
publicPath: 'client/dist/',
filename: 'build.js',
filename:'build.js',
},
resolve: {
// NPM by default installs Runtime Only version, which will not compile html templates
Expand Down

0 comments on commit 71b63c4

Please sign in to comment.