001package org.gwtbootstrap3.extras.summernote.client.ui.base; 002 003/* 004 * #%L 005 * GwtBootstrap3 006 * %% 007 * Copyright (C) 2015 GwtBootstrap3 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import com.google.gwt.dom.client.Node; 024 025/** 026 * Handler interface for Summernote Hint (auto-completion) feature. 027 * 028 * @author Xiaodong Sun 029 */ 030public interface HintHandler { 031 032 /** 033 * Returns the suggestion items for the matched keyword.<br> 034 * <br> 035 * <b>REQUIRED</b>: it must be implemented. 036 * 037 * @param keyword the matched keyword. 038 * @return the suggestion items 039 */ 040 String[] onSearch(String keyword); 041 042 /** 043 * Returns the suggestion item's template on suggestion pop-over.<br> 044 * <br> 045 * <b>OPTIONAL</b>: defaults to the suggestion item. 046 * 047 * @param item suggestion item 048 * @return the item template (may be HTML) 049 */ 050 String getTemplate(String item); 051 052 /** 053 * Returns the node to be inserted to the editor when selecting a 054 * suggestion.<br> 055 * <br> 056 * <b>OPTIONAL</b>: defaults to simple text node for suggestion item. 057 * 058 * @param item selected suggestion item 059 * @return the node to be inserted to the editor 060 */ 061 Node getContent(String item); 062 063}