<commit_before>(function (Q, $, window, undefined) {

    /**
     * Streams/webrtc/preview tool.
     * Renders a tool to preview Streams/webrtc
     * @class Streams/webrtc/preview
     * @constructor
     * @param {Object} [options] options to pass besides the ones to Streams/preview tool
     */
    Q.Tool.define("Streams/webrtc/preview", ["Streams/preview"], function _Streams_webrtc_preview (options, preview) {
            var tool = this;
            var state = this.state;
            tool.preview = preview;
			
			preview.state.editable = false;

            //preview.state.creatable.preprocess = tool.composer.bind(this);

            //Q.addStylesheet('{{Streams}}/css/tools/webrtcPreview.css', { slotName: 'Streams' });

            Q.Text.get('Streams/content', function (err, text) {
                var msg = Q.firstErrorMessage(err);
                if (msg) {
                    return console.warn(msg);
                }

                tool.text = text;
                preview.state.onRefresh.add(tool.refresh.bind(tool));
            });
        },

        {

        },

{
        refresh: function (stream) {
            var tool = this;
            var state = this.state;
            var $toolElement = $(tool.element);

            if (!Q.Streams.isStream(stream)) {
                return;
            }

            tool.stream = stream;

            // retain with stream
            Q.Streams.retainWith(tool).get(stream.fields.publisherId, stream.fields.name);

            setTimeout(function () {
                $toolElement.tool("Streams/preview", {
                    publisherId: state.publisherId,
                    streamName: state.streamName
                }).tool("Streams/default/preview").activate();
            }, 0);

            $toolElement.on(Q.Pointer.fastclick, function () {
                var WebConference = Q.Streams.WebRTC();
                WebConference.start({
                    element: document.body,
                    roomId: stream.fields.name.split('/').pop(),
                    roomPublisherId: stream.fields.publisherId,
                    mode: 'node',
                    startWith: {video: false, audio: true},
                    onWebRTCRoomCreated: function() {
                        console.log('onWebRTCRoomCreated', this);
                    },
                    onWebrtcControlsCreated: function() {
                        console.log('onWebrtcControlsCreated', this);
                    }
                });
            });
        }
    });

})(Q, Q.$, window);<commit_msg>Make Streams/webrtc preview tool non editable by default.<commit_after>(function (Q, $, window, undefined) {
    /**
     * Streams/webrtc/preview tool.
     * Renders a tool to preview Streams/webrtc
     * @class Streams/webrtc/preview
     * @constructor
     * @param {Object} [options] options to pass besides the ones to Streams/preview tool
     */
    Q.Tool.define("Streams/webrtc/preview", ["Streams/preview"], function _Streams_webrtc_preview (options, preview) {
        var tool = this;
        var state = this.state;
        tool.preview = preview;
			
        //preview.state.creatable.preprocess = tool.composer.bind(this);

        //Q.addStylesheet('{{Streams}}/css/tools/webrtcPreview.css', { slotName: 'Streams' });

        preview.state.editable = this.state.editable;

        Q.Text.get('Streams/content', function (err, text) {
            var msg = Q.firstErrorMessage(err);
            if (msg) {
                return console.warn(msg);
            }

            tool.text = text;
            preview.state.onRefresh.add(tool.refresh.bind(tool));
        });
    },

    {
        editable: false
    },

{
    refresh: function (stream) {
        var tool = this;
        var state = this.state;
        var $toolElement = $(tool.element);

        if (!Q.Streams.isStream(stream)) {
            return;
        }

        tool.stream = stream;

        // retain with stream
        Q.Streams.retainWith(tool).get(stream.fields.publisherId, stream.fields.name);

        $toolElement.tool("Streams/default/preview").activate();

        $toolElement.on(Q.Pointer.fastclick, function () {
            var WebConference = Q.Streams.WebRTC();
            WebConference.start({
                element: document.body,
                roomId: stream.fields.name.split('/').pop(),
                roomPublisherId: stream.fields.publisherId,
                mode: 'node',
                startWith: {video: false, audio: true},
                onWebRTCRoomCreated: function() {
                    console.log('onWebRTCRoomCreated', this);
                },
                onWebrtcControlsCreated: function() {
                    console.log('onWebrtcControlsCreated', this);
                }
            });
        });
    }
});

})(Q, Q.$, window);
{'fraction_non_alphanumeric': 0.126053876208102, 'fraction_numerical': 0.00020563438206868187, 'mean_word_length': 1.6406080347448426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7586130', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1306, 'n_words': 245}